Welcome! You have found the homepage of the Fall 2021 manifestation of Math 218.
Sage has a built-in syntax for defining elementary matrices.
To define the elementary matrix of size n corresponding to the
row-swap ri <-> rj
, we use the syntax elementary_matrix(n,
row1=i-1, row2=j-1)
. Note that we need to subtract one from the row
indices because in python indices start at zero.
In this example, we define the 10x10 elementary matrix corresponding to swapping row 4 with row 8.
To define the elementary matrix of size n corresponding to the row
scaling c*ri -> ri
, we use the syntax elementary_matrix(n,
row1=i-1, scale=c)
. Again, it is important that we subtract one from
the row index because python counts from zero, not one.
In this example, we define the 6x6 elementary matrix corresponding to scaline row 5 by -33.
To define the elementary matrix of size n corresponding to the row
addition ri + c*rj -> ri
, we use the
syntax elementary_matrix(n, row1=i-1, row2=j-1, scale=c)
. Again,
we need to subtract one from each row index because counting in python starts
at zero, not one.
In this example, we define the 4x4 elementary matrix corresponding to scaline
r3 - 8*r1 -> r3
.