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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<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 />

sage: b = a.change_ring(R.fraction_field())<br />

sage: b.echelon_form()<br />

# potentially useful<br />

[ 1 y/x]<br />

[ 0 0]<br />

Echelon form is not defined over arbitrary rings:<br />

sage: a = matrix(Integers(9),3,range(9))<br />

sage: a.echelon_form()<br />

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

...<br />

NotImplementedError: Echelon form not implemented over ’Ring <strong>of</strong> integers modulo 9’.<br />

Involving a sparse matrix:<br />

sage: m = matrix(3,[1, 1, 1, 1, 0, 2, 1, 2, 0], sparse=True); m<br />

[1 1 1]<br />

[1 0 2]<br />

[1 2 0]<br />

sage: m.echelon_form()<br />

[ 1 0 2]<br />

[ 0 1 -1]<br />

[ 0 0 0]<br />

sage: m.echelonize(); m<br />

[ 1 0 2]<br />

[ 0 1 -1]<br />

[ 0 0 0]<br />

The transformation matrix is optionally returned:<br />

sage: m_original = m<br />

sage: transformation_matrix = m.echelonize(transformation=True)<br />

sage: m == transformation_matrix * m_original<br />

True<br />

eigenmatrix_left()<br />

Return matrices D <strong>and</strong> P, where D is a diagonal matrix <strong>of</strong> eigenvalues <strong>and</strong> P is the corresponding matrix<br />

where the rows are corresponding eigenvectors (or zero vectors) so that P*self = D*P.<br />

EXAMPLES:<br />

sage: A = matrix(QQ,3,3,range(9)); A<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: D, P = A.eigenmatrix_left()<br />

sage: D<br />

[ 0 0 0]<br />

[ 0 -1.348469228349535 0]<br />

[ 0 0 13.34846922834954]<br />

sage: P<br />

[ 1 -2 1]<br />

[ 1 0.3101020514433644 -0.3797958971132713]<br />

[ 1 1.289897948556636 1.579795897113272]<br />

sage: P*A == D*P<br />

True<br />

Because P is invertible, A is diagonalizable.<br />

155

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

Saved successfully!

Ooh no, something went wrong!