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

An (extreme) example <strong>of</strong> properly grouping similar eigenvalues.<br />

sage: G = graphs.HigmanSimsGraph()<br />

sage: A = G.adjacency_matrix().change_ring(RDF)<br />

sage: A.eigenvalues(algorithm=’symmetric’, tol=1.0e-5)<br />

[(-8.0, 22), (2.0, 77), (22.0, 1)]<br />

TESTS:<br />

Testing bad input.<br />

sage: A = matrix(CDF, 2, range(4))<br />

sage: A.eigenvalues(algorithm=’junk’)<br />

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

...<br />

ValueError: algorithm must be ’default’, ’symmetric’, or ’hermitian’, not junk<br />

sage: A = matrix(CDF, 2, 3, range(6))<br />

sage: A.eigenvalues()<br />

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

...<br />

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

sage: A = matrix(CDF, 2, [1, 2, 3, 4*I])<br />

sage: A.eigenvalues(algorithm=’symmetric’)<br />

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

...<br />

TypeError: cannot apply symmetric algorithm to matrix with complex entries<br />

sage: A = matrix(CDF, 2, 2, range(4))<br />

sage: A.eigenvalues(tol=’junk’)<br />

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

...<br />

TypeError: tolerance parameter must be a real number, not junk<br />

sage: A = matrix(CDF, 2, 2, range(4))<br />

sage: A.eigenvalues(tol=-0.01)<br />

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

...<br />

ValueError: tolerance parameter must be positive, not -0.01<br />

A very small matrix.<br />

sage: matrix(CDF,0,0).eigenvalues()<br />

[]<br />

eigenvectors_left()<br />

Compute the left eigenvectors <strong>of</strong> a matrix <strong>of</strong> double precision real or complex numbers (i.e. RDF or CDF).<br />

OUTPUT: Returns a list <strong>of</strong> triples, each <strong>of</strong> the form (e,[v],1), where e is the eigenvalue, <strong>and</strong> v is an<br />

associated left eigenvector. If the matrix is <strong>of</strong> size n, then there are n triples. Values are computed with the<br />

SciPy library.<br />

The format <strong>of</strong> this output is designed to match the format for exact results. However, since matrices here<br />

have numerical entries, the resulting eigenvalues will also be numerical. No attempt is made to determine<br />

if two eigenvalues are equal, or if eigenvalues might actually be zero. So the algebraic multiplicity <strong>of</strong> each<br />

eigenvalue is reported as 1. Decisions about equal eigenvalues or zero eigenvalues should be addressed in<br />

the calling routine.<br />

The SciPy routines used for these computations produce eigenvectors normalized to have length 1, but on<br />

different hardware they may vary by a sign. So for doctests we have normalized output by forcing their<br />

365

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

Saved successfully!

Ooh no, something went wrong!