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

[<br />

(0, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Rational Field<br />

User basis matrix:<br />

[ 1 -2 1]),<br />

(-1.348469228349535, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Algebraic Field<br />

User basis matrix:<br />

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

(13.34846922834954, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Algebraic Field<br />

User basis matrix:<br />

[ 1 3.069693845669907 5.139387691339814])<br />

]<br />

sage: es = A.eigenspaces_right(format=’galois’); es<br />

[<br />

(0, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Rational Field<br />

User basis matrix:<br />

[ 1 -2 1]),<br />

(a1, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Number Field in a1 with defining polynomi<br />

User basis matrix:<br />

[ 1 1/5*a1 + 2/5 2/5*a1 - 1/5])<br />

]<br />

sage: es = A.eigenspaces_right(format=’galois’, algebraic_multiplicity=True); es<br />

[<br />

(0, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Rational Field<br />

User basis matrix:<br />

[ 1 -2 1], 1),<br />

(a1, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Number Field in a1 with defining polynomi<br />

User basis matrix:<br />

[ 1 1/5*a1 + 2/5 2/5*a1 - 1/5], 1)<br />

]<br />

sage: e, v, n = es[0]; v = v.basis()[0]<br />

sage: delta = v*e - A*v<br />

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

True<br />

The same computation, but with implicit base change to a field:<br />

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

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: A.eigenspaces_right(format=’galois’)<br />

[<br />

(0, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Rational Field<br />

User basis matrix:<br />

[ 1 -2 1]),<br />

(a1, Vector space <strong>of</strong> degree 3 <strong>and</strong> dimension 1 over Number Field in a1 with defining polynomi<br />

User basis matrix:<br />

[ 1 1/5*a1 + 2/5 2/5*a1 - 1/5])<br />

]<br />

This method is only applicable to exact matrices. The “eigenmatrix” routines for matrices with doubleprecision<br />

floating-point entries (RDF, CDF) are the best alternative. (Since some platforms return eigenvectors<br />

that are the negatives <strong>of</strong> those given here, this one example is not tested here.) There are also<br />

“eigenmatrix” routines for matrices with symbolic entries.<br />

sage: B = matrix(RR, 3, 3, range(9))<br />

sage: B.eigenspaces_right()<br />

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

...<br />

163

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

Saved successfully!

Ooh no, something went wrong!