summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-poly.el
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2005-10-07 21:18:22 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2005-10-07 21:18:22 +0000
commit8fc5f8233b811bf2fe08cb641a4d00538c654030 (patch)
tree8ba199e509072e028924dbf93d64dd25e1a82c67 /lisp/calc/calc-poly.el
parentd7b79b09b1dc1bc5e58772bd099f4324d93182c9 (diff)
downloademacs-8fc5f8233b811bf2fe08cb641a4d00538c654030.tar.gz
(math-expand-term): Check for matrices instead of checking
calc-matrix-mode when deciding how to expand.
Diffstat (limited to 'lisp/calc/calc-poly.el')
-rw-r--r--lisp/calc/calc-poly.el25
1 files changed, 9 insertions, 16 deletions
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el
index e27705de98a..4714b2f7d38 100644
--- a/lisp/calc/calc-poly.el
+++ b/lisp/calc/calc-poly.el
@@ -1069,25 +1069,18 @@
(math-add-or-sub (list '/ (nth 1 (nth 1 expr)) (nth 2 expr))
(list '/ (nth 2 (nth 1 expr)) (nth 2 expr))
nil (eq (car (nth 1 expr)) '-)))
- ((and (eq calc-matrix-mode 'matrix)
- (eq (car-safe expr) '^)
- (natnump (nth 2 expr))
- (> (nth 2 expr) 1)
- (memq (car-safe (nth 1 expr)) '(+ -)))
- (if (= (nth 2 expr) 2)
- (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 1 expr))
- (list '* (nth 2 (nth 1 expr)) (nth 1 expr))
- nil (eq (car (nth 1 expr)) '-))
- (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (list '^ (nth 1 expr)
- (1- (nth 2 expr))))
- (list '* (nth 2 (nth 1 expr)) (list '^ (nth 1 expr)
- (1- (nth 2 expr))))
- nil (eq (car (nth 1 expr)) '-))))
((and (eq (car-safe expr) '^)
(memq (car-safe (nth 1 expr)) '(+ -))
(integerp (nth 2 expr))
- (if (and (eq calc-matrix-mode 'matrix)
- (> (nth 2 expr) 1))
+ (if (and
+ (or (math-known-matrixp (nth 1 (nth 1 expr)))
+ (math-known-matrixp (nth 2 (nth 1 expr)))
+ (and
+ calc-matrix-mode
+ (not (eq calc-matrix-mode 'scalar))
+ (not (and (math-known-scalarp (nth 1 (nth 1 expr)))
+ (math-known-scalarp (nth 2 (nth 1 expr)))))))
+ (> (nth 2 expr) 1))
(if (= (nth 2 expr) 2)
(math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 1 expr))
(list '* (nth 2 (nth 1 expr)) (nth 1 expr))