Description: Fix error in matrix exponentiation
 This patch was written by SageMath but not yet committed into Maxima releases.
 However, it is needed for SageMath to work correctly:
 .
 https://git.sagemath.org/sage.git/tree/build/pkgs/maxima/patches/matrixexp.patch
Author: Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
Bug-Sage: http://trac.sagemath.org/ticket/13973
Bug: https://sourceforge.net/p/maxima/bugs/2596/
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/share/linearalgebra/matrixexp.lisp
+++ b/share/linearalgebra/matrixexp.lisp
@@ -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_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
     (setq m (length sp))
     (dotimes (i m)
       (setq zi (nth i sp))
