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

sage: spectrum[0][0]<br />

2.0<br />

sage: (RDF^4).subspace(spectrum[0][1].basis())<br />

Vector space <strong>of</strong> degree 4 <strong>and</strong> dimension 1 over Real Double Field<br />

Basis matrix:<br />

[ 1.0 -2.0 3.0 1.0]<br />

sage: e, V = spectrum[2]<br />

sage: v = V.basis()[0]<br />

sage: diff = (m*v).change_ring(CDF) - e*v<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 />

eigenvalues(algorithm=’default’, tol=None)<br />

Returns a list <strong>of</strong> eigenvalues.<br />

INPUT:<br />

•self - a square matrix<br />

•algorithm - default: ’default’<br />

–’default’ - applicable to any matrix with double-precision floating point entries. Uses the<br />

eigvals() method from SciPy.<br />

–’symmetric’ - converts the matrix into a real matrix (i.e. with entries from RDF), then applies<br />

the algorithm for Hermitian matrices. This algorithm can be significantly faster than the<br />

’default’ algorithm.<br />

–’hermitian’ - uses the eigh() method from SciPy, which applies only to real symmetric<br />

or complex Hermitian matrices. Since Hermitian is defined as a matrix equaling its conjugatetranspose,<br />

for a matrix with real entries this property is equivalent to being symmetric. This<br />

algorithm can be significantly faster than the ’default’ algorithm.<br />

•’tol’ - default: None - if set to a value other than None this is interpreted as a small real number<br />

used to aid in grouping eigenvalues that are numerically similar. See the output description for more<br />

information.<br />

Warning: When using the ’symmetric’ or ’hermitian’ algorithms, no check is made on the<br />

input matrix, <strong>and</strong> only the entries below, <strong>and</strong> on, the main diagonal are employed in the computation.<br />

Methods such as is_symmetric() <strong>and</strong> is_hermitian() could be used to verify this beforeh<strong>and</strong>.<br />

OUTPUT:<br />

Default output for a square matrix <strong>of</strong> size n is a list <strong>of</strong> n eigenvalues from the complex double field, CDF.<br />

If the ’symmetric’ or ’hermitian’ algorithms are chosen, the returned eigenvalues are from the<br />

real double field, RDF.<br />

If a tolerance is specified, an attempt is made to group eigenvalues that are numerically similar. The return<br />

is then a list <strong>of</strong> pairs, where each pair is an eigenvalue followed by its multiplicity. The eigenvalue reported<br />

is the mean <strong>of</strong> the eigenvalues computed, <strong>and</strong> these eigenvalues are contained in an interval (or disk) whose<br />

radius is less than 5*tol for n < 10, 000 in the worst case.<br />

363

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

Saved successfully!

Ooh no, something went wrong!