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

NotImplementedError: eigenspaces cannot be computed reliably for inexact rings such as Real<br />

consult numerical or symbolic matrix classes for other options<br />

sage: em = B.change_ring(RDF).eigenmatrix_right()<br />

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

[ 13.3484692283 0.0 0.0]<br />

[ 0.0 -1.34846922835 0.0]<br />

[ 0.0 0.0 0.0]<br />

sage: eigenvectors = em[1]; eigenvectors # not tested<br />

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

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

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

sage: x, y = var(’x y’)<br />

sage: S = matrix([[x, y], [y, 3*x^2]])<br />

sage: em = S.eigenmatrix_right()<br />

sage: eigenvalues = em[0]; eigenvalues<br />

[3/2*x^2 + 1/2*x - 1/2*sqrt(9*x^4 - 6*x^3 + x^2 + 4*y^2)<br />

[ 0 3/2*x^2 + 1/2*x + 1/2*sqrt(9*x^4 -<br />

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

[ 1<br />

[1/2*(3*x^2 - x - sqrt(9*x^4 - 6*x^3 + x^2 + 4*y^2))/y 1/2*(3*x^2 - x + sqrt(9*x^4 - 6*x^3 +<br />

TESTS:<br />

sage: B = matrix(QQ, 2, 3, range(6))<br />

sage: B.eigenspaces_right()<br />

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

...<br />

TypeError: matrix must be square, not 2 x 3<br />

sage: B = matrix(QQ, 4, 4, range(16))<br />

sage: B.eigenspaces_right(format=’junk’)<br />

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

...<br />

ValueError: format keyword must be None, ’all’ or ’galois’, not junk<br />

sage: B.eigenspaces_right(algebraic_multiplicity=’garbage’)<br />

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

...<br />

ValueError: algebraic_multiplicity keyword must be True or False<br />

eigenvalues(extend=True)<br />

Return a sequence <strong>of</strong> the eigenvalues <strong>of</strong> a matrix, with multiplicity. If the eigenvalues are roots <strong>of</strong> polynomials<br />

in QQ, then QQbar elements are returned that represent each separate root.<br />

If the option extend is set to False, only eigenvalues in the base ring are considered.<br />

EXAMPLES:<br />

sage: a = matrix(QQ, 4, range(16)); a<br />

[ 0 1 2 3]<br />

[ 4 5 6 7]<br />

[ 8 9 10 11]<br />

[12 13 14 15]<br />

sage: sorted(a.eigenvalues(), reverse=True)<br />

[32.46424919657298, 0, 0, -2.464249196572981]<br />

164 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!