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: B.left_kernel()==L.row_space()<br />

True<br />

A matrix to show that the null space <strong>of</strong> the L matrix is the column space <strong>of</strong> the starting matrix.<br />

sage: A=r<strong>and</strong>om_matrix(QQ, 5, 7, algorithm=’subspaces’, rank=None); A # r<strong>and</strong>om<br />

[-31 12 -9 -27 21 2 -15]<br />

[105 -24 6 103 -30 -34 79]<br />

[ 29 -9 5 26 -14 -5 17]<br />

[233 -55 16 228 -71 -73 173]<br />

[-42 10 -3 -41 13 13 -31]<br />

sage: (A.nrows(), A.ncols())<br />

(5, 7)<br />

sage: all([x in ZZ for x in A.list()])<br />

True<br />

sage: A.nullity() # r<strong>and</strong>om<br />

1<br />

sage: A_exp<strong>and</strong>ed=A.augment(identity_matrix(5)).rref()<br />

sage: A_exp<strong>and</strong>ed # r<strong>and</strong>om<br />

[ 1 0 0 0 0 1 0 0 3 7 25 151]<br />

[ 0 1 0 0 1 2 1 0 5 21 84 493]<br />

[ 0 0 1 0 -1 2 0 0 2 13 53 308]<br />

[ 0 0 0 1 0 -1 1 0 -2 -3 -9 -57]<br />

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

sage: all([x in ZZ for x in A_exp<strong>and</strong>ed.list()])<br />

True<br />

sage: C=A_exp<strong>and</strong>ed.submatrix(0,0,A.nrows()-A.nullity(),A.ncols())<br />

sage: L=A_exp<strong>and</strong>ed.submatrix(A.nrows()-A.nullity(),A.ncols())<br />

sage: A.right_kernel()==C.right_kernel()<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 />

TESTS:<br />

The designated rank <strong>of</strong> the L matrix cannot be greater than the number <strong>of</strong> desired rows, nor can the rank be<br />

negative.<br />

sage: r<strong>and</strong>om_matrix(QQ, 19, 20, algorithm=’subspaces’, rank=21)<br />

Traceback (most recent call last):<br />

...<br />

ValueError: rank cannot exceed the number <strong>of</strong> rows or columns.<br />

sage: r<strong>and</strong>om_matrix(QQ, 19, 20, algorithm=’subspaces’, rank=-1)<br />

Traceback (most recent call last):<br />

...<br />

ValueError: matrices must have rank zero or greater.<br />

REFERENCES:<br />

AUTHOR:<br />

Billy Wonderly (2010-07)<br />

55

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

Saved successfully!

Ooh no, something went wrong!