Definition SQM. Square Matrix.
A matrix with \(m\) rows and \(n\) columns is square if \(m=n\text{.}\) In this case, we say the matrix has size \(n\text{.}\) To emphasize the situation when a matrix is not square, we will call it rectangular.
.is_
, and these might be referred to as “predicates” or “queries.”. In the Sage notebook, define a simple matrix A
, and then in a cell type A.is_
, followed by pressing the TAB
key rather than evaluating the cell. You will get a list of numerous properties that you can investigate for the matrix A
. (Tab-completion will not work as advertised with the Sage Cell server.).is_singular()
. We will redo Example S and Example NM. Note the use of not
in the last compute cell.ZZ
), which in this course is unlikely to be what you really want.identity_matrix()
function a constructor, since it builds something from scratch, in this case a very particular type of matrix.=
is used to assign an object to a new name, while ==
is used to test equality of two objects. I frequently make the mistake of forgetting the second equal sign when I mean to test equality.random_matrix()
constructor that uses the algorithm='unimodular'
keyword. We will have to wait for Chapter D before we can give a full explanation, but for now, understand that this command will always create a square matrix that is nonsingular. Also realize that there are square nonsingular matrices which will never be the output of this command. In other words, this command creates elements of just a subset of all possible nonsingular matrices.A
as random for our automated testing process. After a few runs, notice that you can also edit the value of n
to create matrices of different sizes. With a matrix A
defined, run the next three cells, which by Theorem NME1 each always produce True
as their output, no matter what value A
has, so long as A
is nonsingular. Read the code and try to determine exactly how they correspond to the parts of the theorem (some commentary along these lines follows).range(n)
is incredibly useful, as it will create a list of the integers from 0
up to, but not including, n
. (We saw this command briefly in Sage FDV.) So, for example, range(3) == [0,1,2]
is True
. Pivots are returned as a “tuple” which is very much like a list, except we cannot change the contents. We can see the difference by the way the tuple prints with parentheses ((,)
) rather than brackets ([,]
). We can convert a list to a tuple with the tuple()
command, in order to make the comparison succeed.