Matrix exponential in Pari/GP

March 18, 2013 at 12:24 - by eelvex   |   no comments (Leave a comment)

Share on RedditShare on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponPrint this page

For the well behaved matrices of quantum mechanics, it's simply:

matexp(A) = {
P = mateigen(A);
(P*matdiagonal(exp(polroots(charpoly(A))))*matadjoint(P))/matdet(P)
}

using the fact that  e^A = P \times \mathrm{diag}(e^{\lambda_1}, e^{\lambda_2},\ldots) \times P^{-1} where \lambda_i are A's eigenvalues and P is the matrix of eigenvectors of A.

For example

matexp([1,2;3,4])
[51.968956198705003658124484242647420628 + 0.E-37*I 74.736564567003212549882577707218180515 + 0.E-37*I]
[112.10484685050481882482386656082727077 + 0.E-36*I 164.07380304920982248294835080347469140 + 0.E-36*I]

Wolfram alpha agrees:
(51.969 | 74.7366
112.105 | 164.074)

No tips yet.
Be the first to tip!
Like this post? Tip me with bitcoin!

1MFMjzovovcRvfKv5X2VpX1VCpSiveKPed

Share on RedditShare on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponPrint this page
{ Tags: , , }

no comments

RSS / trackback

respond

Real Time Analytics