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

[ 1 1 1]<br />

[ -2 0.1303061543300932 3.069693845669907]<br />

[ 1 -0.7393876913398137 5.139387691339814]<br />

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

True<br />

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

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

True<br />

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

is 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_right()<br />

sage: D<br />

[2 0 0]<br />

[0 2 0]<br />

[0 0 2]<br />

sage: P<br />

[1 0 0]<br />

[0 0 0]<br />

[0 0 0]<br />

sage: A*P == P*D<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: B = matrix(QQ, 3, 3, range(9))<br />

sage: em = B.change_ring(RDF).eigenmatrix_right()<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[0,i].sign()<br />

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

sage: evectors<br />

[ 0.164763817... 0.799699663... 0.408248290...]<br />

[ 0.505774475... 0.104205787... -0.816496580...]<br />

[ 0.846785134... -0.591288087... 0.408248290...]<br />

eigenspaces_left(format=’all’, var=’a’, algebraic_multiplicity=False)<br />

Compute the left eigenspaces <strong>of</strong> a matrix.<br />

Note that eigenspaces_left() <strong>and</strong> left_eigenspaces() are identical methods. Here “left”<br />

refers to the eigenvectors being placed to the left <strong>of</strong> the matrix.<br />

INPUT:<br />

157

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

Saved successfully!

Ooh no, something went wrong!