Computing matrix exponentials



Robert Dodier <robert.dodier at gmail.com> writes:

> On 2012-12-14, Rupert Swarbrick <rswarbrick at gmail.com> wrote:
>
>> If not, I would really like to find a way to hook into the simplifier
>
>   matchdeclare (mm, suitable_matrix_p);
>   tellsimp (exp (mm), my_matrix_exp (mm));
>

Ah, it's easier than I feared! Cool.

> I didn't see any examples of matrix exponential calculations in the test
> script -- did I miss something?

The only example that actually checks the exponential is giving sensible
answers is the one using "diag_mat_errors" (since exp(diag_matrix(...))
exponentiates the old-fashioned way). I would like to improve this!

To prove the code at least works after a fashion:

(%i19) ward_matrix_exponential (matrix ([1.0, 0], [0, 1.0]));
                   [ 2.718281828459045         0.0        ]
(%o19)             [                                      ]
                   [        0.0         2.718281828459045 ]
(%i20) ward_matrix_exponential (matrix ([1b0, 0], [0, 1b0]));
                 [ 2.718281828459045b0         0.0b0        ]
(%o20)           [                                          ]
                 [        0.0b0         2.718281828459045b0 ]
(%i21) float(ward_matrix_exponential (
               matrix ([1,-2,3,-4], [-5,-6,-7,-8],
                       [-9,-10,-11,-12], [-13,14,-15,-16b0])));
                [   3.470106840541206   ]         [ - 23.10259917295292 ]
                [                       ]         [                     ]
                [   .5451828980115822   ]         [ - 1.952572569199982 ]
(%o21)  Col 1 = [                       ] Col 2 = [                     ]
                [  - 2.984728521786326  ]         [  8.393306130644127  ]
                [                       ]         [                     ]
                [ - 0.00880516207293516 ]         [  9.14360740721301   ]
                        [  15.10464093068505  ]         [ - .8014955229469515 ]
                        [                     ]         [                     ]
                        [  1.321907172063737  ]         [ - .1485406279134143 ]
                Col 3 = [                     ] Col 4 = [                     ]
                        [ - 5.797476414263982 ]         [  .8439341087562101  ]
                        [                     ]         [                     ]
                        [ - 5.732874998799312 ]         [ - .1203037903101915 ]

(The float call is because otherwise one scaling routine takes out an
exact power of %e, which makes the answer look rather odd)

No, I don't have error estimates for the last one. Yet...

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20121214/53319ef1/attachment.pgp>;