08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

True<br />

sage: A.row_space() == C.row_space()<br />

True<br />

sage: A.column_space() == L.right_kernel()<br />

True<br />

sage: A.left_kernel() == L.row_space()<br />

True<br />

For a nonsingular matrix, the right half <strong>of</strong> the extended echelon form is the inverse matrix.<br />

sage: B = matrix(QQ, [[1,3,4], [1,4,4], [0,-2,-1]])<br />

sage: E = B.extended_echelon_form()<br />

sage: J = E.matrix_from_columns(range(3,6)); J<br />

[-4 5 4]<br />

[-1 1 0]<br />

[ 2 -2 -1]<br />

sage: J == B.inverse()<br />

True<br />

The result is in echelon form, so if the base ring is not a field, the leading entry <strong>of</strong> each row may not be 1.<br />

But you can easily change to the fraction field if necessary.<br />

sage: A = matrix(ZZ, [[16, 20, 4, 5, -4, 13, 5],<br />

... [10, 13, 3, -3, 7, 11, 6],<br />

... [-12, -15, -3, -3, 2, -10, -4],<br />

... [10, 13, 3, 3, -1, 9, 4],<br />

... [4, 5, 1, 8, -10, 1, -1]])<br />

sage: E = A.extended_echelon_form(subdivide=True); E<br />

[ 2 0 -2 2 -9 -3 -4| 0 4 -3 -9 4]<br />

[ 0 1 1 2 0 1 1| 0 1 2 1 1]<br />

[ 0 0 0 3 -4 -1 -1| 0 3 1 -3 3]<br />

[--------------------+--------------]<br />

[ 0 0 0 0 0 0 0| 1 6 3 -6 5]<br />

[ 0 0 0 0 0 0 0| 0 7 2 -7 6]<br />

sage: J = E.matrix_from_columns(range(7,12)); J<br />

[ 0 4 -3 -9 4]<br />

[ 0 1 2 1 1]<br />

[ 0 3 1 -3 3]<br />

[ 1 6 3 -6 5]<br />

[ 0 7 2 -7 6]<br />

sage: J*A == A.echelon_form()<br />

True<br />

sage: B = A.change_ring(QQ)<br />

sage: B.extended_echelon_form(subdivide=True)<br />

[ 1 0 -1 0 -19/6 -7/6 -5/3| 0 0 -89/42 -5/2 1/7]<br />

[ 0 1 1 0 8/3 5/3 5/3| 0 0 34/21 2 -1/7]<br />

[ 0 0 0 1 -4/3 -1/3 -1/3| 0 0 1/21 0 1/7]<br />

[------------------------------------------------+----------------------------------]<br />

[ 0 0 0 0 0 0 0| 1 0 9/7 0 -1/7]<br />

[ 0 0 0 0 0 0 0| 0 1 2/7 -1 6/7]<br />

Subdivided, or not, the result is immutable, so make a copy if you want to make changes.<br />

sage: A = matrix(FiniteField(7), [[2,0,3], [5,5,3], [5,6,5]])<br />

sage: E = A.extended_echelon_form()<br />

sage: E.is_mutable()<br />

False<br />

sage: F = A.extended_echelon_form(subdivide=True)<br />

sage: F<br />

171

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!