# HG changeset patch # User Jay Belanger # Date 1131564449 0 # Node ID 2a1202853ff49d845b414a700d8a12cda7fafd90 # Parent c57e0cf19ef5185e72e110d57da69cdd1c5bee81 (math-pow-fancy): Further expand product of square matrices. (math-check-known-square-matrixp): Do a more extensive check for square matrices. diff -r c57e0cf19ef5 -r 2a1202853ff4 lisp/calc/calc-arith.el --- a/lisp/calc/calc-arith.el Wed Nov 09 10:45:07 2005 +0000 +++ b/lisp/calc/calc-arith.el Wed Nov 09 19:27:29 2005 +0000 @@ -374,6 +374,13 @@ t) ((eq (car-safe a) '^) (math-check-known-square-matrixp (nth 1 a))) + ((or + (eq (car-safe a) '*) + (eq (car-safe a) '+) + (eq (car-safe a) '-)) + (and + (math-check-known-square-matrixp (nth 1 a)) + (math-check-known-square-matrixp (nth 2 a)))) (t (let ((decl (if (eq (car a) 'var) (or (assq (nth 2 a) math-decls-cache) @@ -1960,7 +1967,8 @@ (if (and (= b -1) (math-known-square-matrixp (nth 1 a)) (math-known-square-matrixp (nth 2 a))) - (list '* (list '^ (nth 2 a) -1) (list '^ (nth 1 a) -1)) + (math-mul (math-pow-fancy (nth 2 a) -1) + (math-pow-fancy (nth 1 a) -1)) (list '^ a b))) ((and (eq (car-safe a) '*) (or (math-known-num-integerp b)