Augmented Matrices
Description
The Sage matrix method .augment() will join two matrices, side-by-side provided they both have the same number of rows. The same method can be used to augment a matrix with a column vector. We can augment the matrix
(1)\begin{align} A = \begin{pmatrix} 1 & -1 & 2 \\ 2 & 1 & 1 \\ 1 & 1 & 0 \end{pmatrix} \end{align}
with the column vector
(2)\begin{align} \mathbf b = \begin{pmatrix} 1 \\ 8 \\ 5 \end{pmatrix} \end{align}
to form the augmented matrix
(3)\begin{align} M = \begin{pmatrix} 1 & -1 & 2 & 1\\ 2 & 1 & 1 & 8\\ 1 & 1 & 0 &5 \end{pmatrix}. \end{align}
Sage Cell
A = matrix(QQ, 3, 3, [[1, -1, 2], [2, 1, 1], [1, 1, 0]])
b = vector(QQ, [1, 8, 5])
M = A.augment(b)
M
Options
Option
The option subdivide=True will create a matrix of the form
(4)\begin{align} M = \left( \begin{array}{ccc|c} 1 & -1 & 2 & 1\\ 2 & 1 & 1 & 8\\ 1 & 1 & 0 &5 \end{array} \right). \end{align}
A = matrix(QQ, 3, 3, [[1, -1, 2], [2, 1, 1], [1, 1, 0]])
b = vector(QQ, [1, 8, 5])
M = A.augment(b, subdivide=True)
M
Tags
CC: math.la.i.mat.augmented
Primary Tags: Linear algebra: Systems of linear equations.
Secondary Tags: Systems of linear equations: Augmented matrices
Related Cells
- Matrices in Sage. Matrices in Sage.
Attribute
Permalink: http://linear.ups.edu/html/section-RREF.html
Author: R. Beezer
Date: 24 Jul 2017 16:59
Submitted by: Tom Judson