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

sage: abs(abs(diff)) < 1e-14<br />

True<br />

TESTS:<br />

sage: m.eigenspaces_left(algebraic_multiplicity=True)<br />

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

...<br />

ValueError: algebraic_multiplicity must be set to False for double precision matrices<br />

left_eigenvectors()<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 />

eigenvectors to have their first non-zero entry equal to one.<br />

EXAMPLES:<br />

sage: m = matrix(RDF, [[-5, 3, 2, 8],[10, 2, 4, -2],[-1, -10, -10, -17],[-2, 7, 6, 13]])<br />

sage: m<br />

[ -5.0 3.0 2.0 8.0]<br />

[ 10.0 2.0 4.0 -2.0]<br />

[ -1.0 -10.0 -10.0 -17.0]<br />

[ -2.0 7.0 6.0 13.0]<br />

sage: spectrum = m.left_eigenvectors()<br />

sage: for i in range(len(spectrum)):<br />

... spectrum[i][1][0]=matrix(RDF, spectrum[i][1]).echelon_form()[0]<br />

sage: spectrum[0]<br />

(2.0, [(1.0, 1.0, 1.0, 1.0)], 1)<br />

sage: spectrum[1]<br />

(1.0, [(1.0, 0.8, 0.8, 0.6)], 1)<br />

sage: spectrum[2]<br />

(-2.0, [(1.0, 0.4, 0.6, 0.2)], 1)<br />

sage: spectrum[3]<br />

(-1.0, [(1.0, 1.0, 2.0, 2.0)], 1)<br />

log_determinant()<br />

Compute the log <strong>of</strong> the absolute value <strong>of</strong> the determinant using LU decomposition.<br />

Note: This is useful if the usual determinant overflows.<br />

EXAMPLES:<br />

sage: m = matrix(RDF,2,2,range(4)); m<br />

[0.0 1.0]<br />

[2.0 3.0]<br />

sage: RDF(log(abs(m.determinant())))<br />

0.69314718056<br />

377

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

Saved successfully!

Ooh no, something went wrong!