summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-arith.el
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2005-11-01 06:23:08 +0000
committerKaroly Lorentey <lorentey@elte.hu>2005-11-01 06:23:08 +0000
commitcd0cf71c4f41023a8d9c20b3a26e44b980992b5a (patch)
treeb763cfec551254e2228335be4e218ed7a9a19109 /lisp/calc/calc-arith.el
parentc40bb1ba81a5df164f0b9b61e3480c55808717b7 (diff)
parent895725e10c0fb68ed21abb48183cc8843bcaadf3 (diff)
downloademacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.tar.gz
emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.tar.bz2
emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.zip
Merged from miles@gnu.org--gnu-2005 (patch 142-148, 615-628)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-615 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-616 Add lisp/mh-e/.arch-inventory * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-617 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-618 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-619 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-620 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-622 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-623 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-624 Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-625 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-626 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-627 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-628 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-142 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-143 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-144 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-145 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-146 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-147 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-148 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-435
Diffstat (limited to 'lisp/calc/calc-arith.el')
-rw-r--r--lisp/calc/calc-arith.el29
1 files changed, 28 insertions, 1 deletions
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el
index feb3c9d25a8..f8057c5f1b9 100644
--- a/lisp/calc/calc-arith.el
+++ b/lisp/calc/calc-arith.el
@@ -1386,6 +1386,7 @@
(and (eq (car-safe b) '^)
(Math-looks-negp (nth 2 b))
(not (and (eq (car-safe a) '^) (Math-looks-negp (nth 2 a))))
+ (not (math-known-matrixp (nth 1 b)))
(math-div a (math-normalize
(list '^ (nth 1 b) (math-neg (nth 2 b))))))
(and (eq (car-safe a) '/)
@@ -1427,6 +1428,30 @@
(list 'calcFunc-idn (math-mul a (nth 1 b))))
(and (math-known-matrixp a)
(math-mul a (nth 1 b)))))
+ (and (math-identity-matrix-p a t)
+ (or (and (eq (car-safe b) 'calcFunc-idn)
+ (= (length b) 2)
+ (list 'calcFunc-idn (math-mul
+ (nth 1 (nth 1 a))
+ (nth 1 b))
+ (1- (length a))))
+ (and (math-known-scalarp b)
+ (list 'calcFunc-idn (math-mul
+ (nth 1 (nth 1 a)) b)
+ (1- (length a))))
+ (and (math-known-matrixp b)
+ (math-mul (nth 1 (nth 1 a)) b))))
+ (and (math-identity-matrix-p b t)
+ (or (and (eq (car-safe a) 'calcFunc-idn)
+ (= (length a) 2)
+ (list 'calcFunc-idn (math-mul (nth 1 a)
+ (nth 1 (nth 1 b)))
+ (1- (length b))))
+ (and (math-known-scalarp a)
+ (list 'calcFunc-idn (math-mul a (nth 1 (nth 1 b)))
+ (1- (length b))))
+ (and (math-known-matrixp a)
+ (math-mul a (nth 1 (nth 1 b))))))
(and (math-looks-negp b)
(math-mul (math-neg a) (math-neg b)))
(and (eq (car-safe b) '-)
@@ -1706,7 +1731,9 @@
(math-div-new-non-trig term))))
(defun math-div-symb-fancy (a b)
- (or (and math-simplify-only
+ (or (and (math-known-matrixp b)
+ (math-mul a (math-pow b -1)))
+ (and math-simplify-only
(not (equal a math-simplify-only))
(list '/ a b))
(and (Math-equal-int b 1) a)