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

sage: A == (~P)*D*P<br />

True<br />

The matrix P may contain zero rows corresponding to eigenvalues for which the algebraic multiplicity is<br />

greater than the geometric multiplicity. In these cases, the matrix is not diagonalizable.<br />

sage: A = jordan_block(2,3); A<br />

[2 1 0]<br />

[0 2 1]<br />

[0 0 2]<br />

sage: A = jordan_block(2,3)<br />

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

sage: D<br />

[2 0 0]<br />

[0 2 0]<br />

[0 0 2]<br />

sage: P<br />

[0 0 1]<br />

[0 0 0]<br />

[0 0 0]<br />

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

True<br />

TESTS:<br />

For matrices with floating point entries, some platforms will return eigenvectors that are negatives <strong>of</strong><br />

those returned by the majority <strong>of</strong> platforms. This test accounts for that possibility. Running this test<br />

independently, without adjusting the eigenvectors could indicate this situation on your hardware.<br />

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

sage: em = A.change_ring(RDF).eigenmatrix_left()<br />

sage: evalues = em[0]; evalues.dense_matrix().zero_at(2e-15)<br />

[ 13.3484692283 0.0 0.0]<br />

[ 0.0 -1.34846922835 0.0]<br />

[ 0.0 0.0 0.0]<br />

sage: evectors = em[1];<br />

sage: for i in range(3):<br />

... scale = evectors[i,0].sign()<br />

... evectors.rescale_row(i, scale)<br />

sage: evectors<br />

[ 0.440242867... 0.567868371... 0.695493875...]<br />

[ 0.897878732... 0.278434036... -0.341010658...]<br />

[ 0.408248290... -0.816496580... 0.408248290...]<br />

eigenmatrix_right()<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 columns are corresponding eigenvectors (or zero vectors) so that self*P = P*D.<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_right()<br />

sage: D<br />

[ 0 0 0]<br />

[ 0 -1.348469228349535 0]<br />

[ 0 0 13.34846922834954]<br />

sage: P<br />

156 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!