changeset 65902:a15a1dd65d9e

(math-expand-term): Check for matrices instead of checking calc-matrix-mode when deciding how to expand.
author Jay Belanger <jay.p.belanger@gmail.com>
date Fri, 07 Oct 2005 21:18:22 +0000
parents f4c158053fb0
children 451fee578520
files lisp/calc/calc-poly.el
diffstat 1 files changed, 9 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-poly.el	Fri Oct 07 21:18:01 2005 +0000
+++ b/lisp/calc/calc-poly.el	Fri Oct 07 21:18:22 2005 +0000
@@ -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))