summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-arith.el
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2005-11-09 19:27:29 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2005-11-09 19:27:29 +0000
commit2f884e83d44f32270309447d3439671898142182 (patch)
tree0bf76cf9c568016d14c4809e5897a2f5c87e3a67 /lisp/calc/calc-arith.el
parent5ee476765c3e0a86c7c97d60fb0c7b3544e7c1dc (diff)
(math-pow-fancy): Further expand product of square matrices.
(math-check-known-square-matrixp): Do a more extensive check for square matrices.
Diffstat (limited to 'lisp/calc/calc-arith.el')
-rw-r--r--lisp/calc/calc-arith.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el
index f8057c5f1b..ba95ee7f71 100644
--- a/lisp/calc/calc-arith.el
+++ b/lisp/calc/calc-arith.el
@@ -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)