15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

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.

[ 8.88178420e-16 4.44089210e-16 2.66453526e-15]]<br />

>>> print abs(A-Z1*T1*Z1.H) # same<br />

[[ 1.00043248e-15 2.22301403e-15 5.55749485e-15]<br />

[ 2.88899660e-15 8.44927041e-15 9.77322008e-15]<br />

[ 3.11291538e-15 1.15463228e-14 1.15464861e-14]]<br />

>>> print abs(A-Z2*T2*Z2.H) # same<br />

[[ 3.34058710e-16 8.88611201e-16 4.18773089e-18]<br />

[ 1.48694940e-16 8.95109973e-16 8.92966151e-16]<br />

[ 1.33228956e-15 1.33582317e-15 3.55373104e-15]]<br />

1.8.4 Matrix Functions<br />

Consider the function f (x) with Taylor series expansion<br />

f (x) =<br />

∞�<br />

k=0<br />

f (k) (0)<br />

x<br />

k!<br />

k .<br />

A matrix function can be defined using this Taylor series for the square matrix A as<br />

f (A) =<br />

∞�<br />

k=0<br />

f (k) (0)<br />

k! Ak .<br />

SciPy Reference Guide, Release 0.8.dev<br />

While, this serves as a useful representation of a matrix function, it is rarely the best way to calculate a matrix function.<br />

Exponential and logarithm functions<br />

The matrix exponential is one of the more common matrix functions. It can be defined for square matrices as<br />

e A =<br />

∞�<br />

k=0<br />

1<br />

k! Ak .<br />

The command linalg.expm3 uses this Taylor series definition to compute the matrix exponential. Due to poor<br />

convergence properties it is not often used.<br />

Another method to compute the matrix exponential is to find an eigenvalue decomposition of A :<br />

and note that<br />

A = VΛV −1<br />

e A = Ve Λ V −1<br />

where the matrix exponential of the diagonal matrix Λ is just the exponential of its elements. This method is implemented<br />

in linalg.expm2 .<br />

The preferred method for implementing the matrix exponential is to use scaling and a Padé approximation for e x .<br />

This algorithm is implemented as linalg.expm .<br />

The inverse of the matrix exponential is the matrix logarithm defined as the inverse of the matrix exponential.<br />

A ≡ exp (log (A)) .<br />

The matrix logarithm can be obtained with linalg.logm .<br />

1.8. Linear Algebra 47

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

Saved successfully!

Ooh no, something went wrong!