Mantra 2.1.1. Matrix mantra.
A matrix is a matrix is a matrix.
Not every matrix should be thought of as an augmented matrix associated to a linear system.
A
is assigned to a matrix in Sage, A[i,j]
is its \((i+1),(j+1)\)-th entry.
A[a:b, c:d]
returns the collection of entries \([A]_{ij}\) with \(a+1\leq i\lt b+1\) and \(c+1\leq j\lt d\text{,}\) arranged as a matrix.
:
blank in this notation removes the corresponding restriction bound (left or right) from the index in question. Thus A[2, :]
returns the third row of \(A\text{,}\) and A[1:, 3]
returns the portion of the fourth column of \(A\) beginning with its second entry.
rows()
and columns()
.
*
is also used for scalar multiplication.
A*colsB[i]
is displayed by Sage as a tuple, though technically for us this is a column vector.
transpose()
method. In the cell below we (a) choose random integers \(1\leq m,n\leq 6\text{,}\) (b) choose a random \(m\times n\) matrix \(A\) with integer entries, and (c) compute the transpose of \(A\text{.}\)