Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#2596 error in matrix exponentiation

None
open
nobody
None
5
2014-08-14
2013-06-19
kcrisman
No

This is a regression in 5.30.0 from 5.29.1:

(%i1) m: matrix([%i*%pi]);
(%o1) [ %i %pi ]
(%i6) matrixexp(m),keepfloat:true;

Unable to find the spectral representation
-- an error. To debug this try: debugmode(true);
(%i7) matrixexp(m),keepfloat:false;

Unable to find the spectral representation
-- an error. To debug this try: debugmode(true);

Point of info - Barton W. has a workaround:

This bug is due to circa January 2013 changes to matrix inversion. A workaround is to set ratmx to true:

Maxima branch_5_30_base_98_g29f9239_dirty http://maxima.sourceforge.net
using Lisp Clozure Common Lisp Version 1.9-r15764 (WindowsX8632)

(%i1) matrixexp(matrix([%i*%pi]));

Unable to find the spectral representation

(%i2) matrixexp(matrix([%i*%pi])), ratmx=true;
(%o2) - 1

Discussion

  • kcrisman
    kcrisman
    2014-05-16

    Potential fix reported downstream on Sage ticket #13973:

     --- a/share/linearalgebra/matrixexp.lisp        2013-10-07
     04:37:12.000000000 +0100
     +++ b/share/linearalgebra/matrixexp.lisp        2014-05-16
     02:16:09.112011893 +0100
     @@ -138,8 +138,8 @@
                (print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
                (print `(ratfac = ,$ratfac))
                (merror "Unable to find the spectrum")))
     -
     -    (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
     +
     +    (setq res ($fullratsimp ($invert (sub (mult z ($ident n)) mat) '$crering) z))
          (setq m (length sp))
          (dotimes (i m)
            (setq zi (nth i sp))
    
     
  • kcrisman
    kcrisman
    2014-08-14

    Here is another example from 5.33. The ratmx workaround does not help here.

    (%i2) m:matrix([1,2,3],[3,2,0],[1,2,1]);
                                      [ 1  2  3 ]
                                      [         ]
    (%o2)                             [ 3  2  0 ]
                                      [         ]
                                      [ 1  2  1 ]
    (%i3) m:%i*m;
                                 [  %i   2 %i  3 %i ]
                                 [                  ]
    (%o3)                        [ 3 %i  2 %i   0   ]
                                 [                  ]
                                 [  %i   2 %i   %i  ]
    (%i4) matrixexp(m),keepfloat:true;
    
    Unable to find the spectral representation
     -- an error. To debug this try: debugmode(true);
    (%i5) matrixexp(m),ratmx:true;
    
    Unable to find the spectral representation
     -- an error. To debug this try: debugmode(true);
    
     
    • kcrisman
      kcrisman
      2014-08-14

      That said, I am not claiming this is a regression, just an example which it doesn't seem ever worked (perhaps for good theoretical reasons, though of course it has such an exp). See http://ask.sagemath.org/question/23784/imaginary-matrix-exponential/ where it came up.