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

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

right_eigenvectors(extend=True)<br />

Compute the right eigenvectors <strong>of</strong> a matrix.<br />

For each distinct eigenvalue, returns a list <strong>of</strong> the form (e,V,n) where e is the eigenvalue, V is a list <strong>of</strong><br />

eigenvectors forming a basis for the corresponding right eigenspace, <strong>and</strong> n is the algebraic multiplicity <strong>of</strong><br />

the eigenvalue. If extend = True (the default), this will return eigenspaces over the algebraic closure<br />

<strong>of</strong> the base field where this is implemented; otherwise it will restrict to eigenvalues in the base field.<br />

EXAMPLES: We compute the right eigenvectors <strong>of</strong> a 3 × 3 rational matrix.<br />

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

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: es = A.eigenvectors_right(); es<br />

[(0, [<br />

(1, -2, 1)<br />

], 1),<br />

(-1.348469228349535, [(1, 0.1303061543300932, -0.7393876913398137)], 1),<br />

(13.34846922834954, [(1, 3.069693845669907, 5.139387691339814)], 1)]<br />

sage: A.eigenvectors_right(extend=False)<br />

[(0, [<br />

(1, -2, 1)<br />

], 1)]<br />

sage: eval, [evec], mult = es[0]<br />

sage: delta = eval*evec - A*evec<br />

sage: abs(abs(delta)) < 1e-10<br />

235

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

Saved successfully!

Ooh no, something went wrong!