Computing matrix exponentials



suggested Matrix exponential ala Maxima:  ..

matexp(m,lim):=block([ans:ident(length(m)),  pow],
     pow:ans,
       for j from 1 thru lim do
          (pow:pow.m/j, ans:ans+pow),
    ans)

This allows you to compute, approximately, the matrix exponential of any 
square
matrix including ones with symbolic entries.

This is essentially substituting the matrix into the taylor series to 
order "lim"  for exp.

Now there is an issue of how far to run the series (that is, setting lim.)

If there are symbolic expressions in the matrix m there may be an advantage
to using  rat(m)  rather than m as an argument.

If there are only numbers, you probably want to do the calculation in 
floating point.
  You need a more sophisticated way of terminating the iteration :)

RJF


On 12/13/2012 4:48 PM, Rupert Swarbrick wrote:
> Hi,
>
> I was messing around with some electronics calculations on the train a
> couple of days ago and (feeling very grown up) solved a first order ODE
> in terms of a matrix exponential. Imagine my distress when I realised
> that Maxima doesn't have a built-in facility for evaluating them in
> floating point!
>
<snip>