New issue 3119 by MRock...@gmail.com: Matrix Exponential
http://code.google.com/p/sympy/issues/detail?id=3119
We should be able to represent matrix exponentials - expressions of the
form a**B with a a scalar and B a matrix.
When asked to operate on this we could either use the eigenvalue
decomposition or represent it as an infinite sum.
For the special but very important case of an arbitrary 2x2 matrix we have
a simple formula. (Of course obtained by eigenvalue decomposition) I
implemented this
several times.
# M the original 2x2 matrix
a = M[0,0]
b = M[0,1]
c = M[1,0]
d = M[1,1]
D = sympy.sqrt((a-d)**2 + 4*b*c)/2
t = sympy.exp((a+d)/2)
M = sympy.Matrix([[0,0],[0,0]])
try:
D = sympy.simplify(D)
t = sympy.simplify(t)
except:
pass
if sympy.Eq(D,0):
# special case
M[0,0] = t * (1 + (a-d)/2)
M[0,1] = t * b
M[1,0] = t * c
M[1,1] = t * (1 - (a-d)/2)
else:
# general case
M[0,0] = t * (sympy.cosh(D) + (a-d)/2 * sympy.sinh(D)/D)
M[0,1] = t * (b * sympy.sinh(D)/D)
M[1,0] = t * (c * sympy.sinh(D)/D)
M[1,1] = t * (sympy.cosh(D) - (a-d)/2 * sympy.sinh(D)/D)
# M is now the result of exp(M)
There is also an old paper titled "Some explicit formulas for the matrix
exponential"
by Dennis Bernstein and Wasin So. They show some formulas for the 3x3 case
but only
for special cases.
Matrix.exp works for the diagonalizable case, and shouldn't be too hard to
extend to the non-diagonalizable case.
Maple's version of this includes an extra argument for a parameter
(http://www.maplesoft.com/support/help/Maple/view.aspx?path=LinearAlgebra/MatrixExponential).
Do you think that would be helpful?