summaryrefslogtreecommitdiff
path: root/math/maxima/files/extra-patch-share_linearalgebra_matrixexp.lisp
blob: 151d0776760bdb0553fa0fa4735bff05c32c4d1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
--- share/linearalgebra/matrixexp.lisp.orig	2019-10-21 03:38:58 UTC
+++ share/linearalgebra/matrixexp.lisp
@@ -138,8 +138,9 @@
 	   (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))
+
+;; patch borrowed from SageMath
+    (setq res ($fullratsimp ($invert_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
     (setq m (length sp))
     (dotimes (i m)
       (setq zi (nth i sp))