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

The right eigenvectors are nothing but the left eigenvectors <strong>of</strong> the transpose matrix:<br />

sage: left = A.transpose().eigenvectors_left(); left<br />

[(-1/2*sqrt(17) + 3/2, [(1, -1/2*sqrt(17) + 3/2)], 1), (1/2*sqrt(17) + 3/2, [(1, 1/2*sqrt(17<br />

sage: right[0][1] == left[0][1]<br />

True<br />

exp()<br />

Return the matrix exponential <strong>of</strong> this matrix X, which is the matrix<br />

e X =<br />

∞∑<br />

k=0<br />

This function depends on maxima’s matrix exponentiation function, which does not deal well with floating<br />

point numbers. If the matrix has floating point numbers, they will be rounded automatically to rational<br />

numbers during the computation.<br />

EXAMPLES:<br />

X k<br />

k! .<br />

sage: m = matrix(SR,2, [0,x,x,0]); m<br />

[0 x]<br />

[x 0]<br />

sage: m.exp()<br />

[1/2*(e^(2*x) + 1)*e^(-x) 1/2*(e^(2*x) - 1)*e^(-x)]<br />

[1/2*(e^(2*x) - 1)*e^(-x) 1/2*(e^(2*x) + 1)*e^(-x)]<br />

sage: exp(m)<br />

[1/2*(e^(2*x) + 1)*e^(-x) 1/2*(e^(2*x) - 1)*e^(-x)]<br />

[1/2*(e^(2*x) - 1)*e^(-x) 1/2*(e^(2*x) + 1)*e^(-x)]<br />

Exp works on 0x0 <strong>and</strong> 1x1 matrices:<br />

sage: m = matrix(SR,0,[]); m<br />

[]<br />

sage: m.exp()<br />

[]<br />

sage: m = matrix(SR,1,[2]); m<br />

[2]<br />

sage: m.exp()<br />

[e^2]<br />

Commuting matrices m, n have the property that e m+n = e m e n (but non-commuting matrices need not):<br />

sage: m = matrix(SR,2,[1..4]); n = m^2<br />

sage: m*n<br />

[ 37 54]<br />

[ 81 118]<br />

sage: n*m<br />

[ 37 54]<br />

[ 81 118]<br />

sage: a = exp(m+n) - exp(m)*exp(n)<br />

sage: a.simplify_rational() == 0<br />

True<br />

The input matrix must be square:<br />

sage: m = matrix(SR,2,3,[1..6]); exp(m)<br />

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

...<br />

ValueError: exp only defined on square matrices<br />

308 Chapter 16. Symbolic matrices

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

Saved successfully!

Ooh no, something went wrong!