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)) < 3e-14<br />

True<br />

TESTS:<br />

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

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

...<br />

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

right_eigenvectors()<br />

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

CDF).<br />

OUTPUT:<br />

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

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

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, [[-9, -14, 19, -74],[-1, 2, 4, -11],[-4, -12, 6, -32],[0, -2, -1, 1]])<br />

sage: m<br />

[ -9.0 -14.0 19.0 -74.0]<br />

[ -1.0 2.0 4.0 -11.0]<br />

[ -4.0 -12.0 6.0 -32.0]<br />

[ 0.0 -2.0 -1.0 1.0]<br />

sage: spectrum = m.right_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, -2.0, 3.0, 1.0)], 1)<br />

sage: spectrum[1]<br />

(1.0, [(1.0, -0.666666666667, 1.33333333333, 0.333333333333)], 1)<br />

sage: spectrum[2]<br />

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

sage: spectrum[3]<br />

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

round(ndigits=0)<br />

Returns a copy <strong>of</strong> the matrix where all entries have been rounded to a given precision in decimal digits<br />

(default 0 digits).<br />

INPUT:<br />

•ndigits - The precision in number <strong>of</strong> decimal digits<br />

OUTPUT:<br />

A modified copy <strong>of</strong> the matrix<br />

382 Chapter 19. Dense matrices using a NumPy backend.

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

Saved successfully!

Ooh no, something went wrong!