Worksheet 8
Compute the reduced row echelon form of \(A = \begin{pmatrix} 8 & -11 & 43 & -2 & 3\\ -3 & 1 & 0 & -1 & 5 \\ 4 & -2 & 2 & -2 & 1 \\ 2 & 8 & 5 & 4 & 1 \end{pmatrix}\) in two ways. First by using the row operations in Sage one by one. Next by using the
.rref()
method on $A$.For the same $A$ as in 1, compute a LU factorization in two ways: using your list of row operations and using the
.LU()
method.This will acquiant you a bit more with some of the syntax for common types in Python/Sage. One way to declare a list in Python is
L = [1,2,3] # a list consisting of 1,2,3
Suppose you want to print out each element of the list one by one
for x in L: print(x)
If you want second entry out of L you would write
L[1]
since Sage starts counting at 0. An example of a function declaration in Python (and hence Sage) is
def f(x): return x+5
Write a function in Sage that consumes a matrix and returns the sum of all entries in the matrix. Test it out on the matrix from 1. Hint:
A.list()
.