# Matrix exponential in Pari/GP

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

matexp(A) = {
P = mateigen(A);
}

using the fact that $e^A = P \times \mathrm{diag}(e^{\lambda_1}, e^{\lambda_2},\ldots) \times P^{-1}$ where 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

{ Tags: , , }