diff options
| author | Jay Belanger | 2005-09-07 19:29:38 +0000 |
|---|---|---|
| committer | Jay Belanger | 2005-09-07 19:29:38 +0000 |
| commit | 2ccc02f2182ab453ef5b056415e16df4454d426e (patch) | |
| tree | 8734125e6b623640e73d4dd953de753f9c27d5fb /lisp | |
| parent | 104fc809f95472cb143388230cdac95052bbefb5 (diff) | |
| download | emacs-2ccc02f2182ab453ef5b056415e16df4454d426e.tar.gz emacs-2ccc02f2182ab453ef5b056415e16df4454d426e.zip | |
(math-expand-term): Multiply out the powers when in matrix mode.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calc/calc-poly.el | 45 |
2 files changed, 41 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd0c2e87e70..89dc0c3a3df 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2005-09-07 Jay Belanger <belanger@truman.edu> | ||
| 2 | |||
| 3 | * calc/calc-poly.el (math-expand-term): Multiply out any powers | ||
| 4 | when in matrix mode. | ||
| 5 | |||
| 1 | 2005-09-08 Chong Yidong <cyd@stupidchicken.com> | 6 | 2005-09-08 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * buff-menu.el (Buffer-menu-sort-by-column): New function. | 8 | * buff-menu.el (Buffer-menu-sort-by-column): New function. |
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el index 3dd19b6f67a..e27705de98a 100644 --- a/lisp/calc/calc-poly.el +++ b/lisp/calc/calc-poly.el | |||
| @@ -1069,18 +1069,45 @@ | |||
| 1069 | (math-add-or-sub (list '/ (nth 1 (nth 1 expr)) (nth 2 expr)) | 1069 | (math-add-or-sub (list '/ (nth 1 (nth 1 expr)) (nth 2 expr)) |
| 1070 | (list '/ (nth 2 (nth 1 expr)) (nth 2 expr)) | 1070 | (list '/ (nth 2 (nth 1 expr)) (nth 2 expr)) |
| 1071 | nil (eq (car (nth 1 expr)) '-))) | 1071 | nil (eq (car (nth 1 expr)) '-))) |
| 1072 | ((and (eq calc-matrix-mode 'matrix) | ||
| 1073 | (eq (car-safe expr) '^) | ||
| 1074 | (natnump (nth 2 expr)) | ||
| 1075 | (> (nth 2 expr) 1) | ||
| 1076 | (memq (car-safe (nth 1 expr)) '(+ -))) | ||
| 1077 | (if (= (nth 2 expr) 2) | ||
| 1078 | (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 1 expr)) | ||
| 1079 | (list '* (nth 2 (nth 1 expr)) (nth 1 expr)) | ||
| 1080 | nil (eq (car (nth 1 expr)) '-)) | ||
| 1081 | (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (list '^ (nth 1 expr) | ||
| 1082 | (1- (nth 2 expr)))) | ||
| 1083 | (list '* (nth 2 (nth 1 expr)) (list '^ (nth 1 expr) | ||
| 1084 | (1- (nth 2 expr)))) | ||
| 1085 | nil (eq (car (nth 1 expr)) '-)))) | ||
| 1072 | ((and (eq (car-safe expr) '^) | 1086 | ((and (eq (car-safe expr) '^) |
| 1073 | (memq (car-safe (nth 1 expr)) '(+ -)) | 1087 | (memq (car-safe (nth 1 expr)) '(+ -)) |
| 1074 | (integerp (nth 2 expr)) | 1088 | (integerp (nth 2 expr)) |
| 1075 | (if (> (nth 2 expr) 0) | 1089 | (if (and (eq calc-matrix-mode 'matrix) |
| 1076 | (or (and (or (> math-mt-many 500000) (< math-mt-many -500000)) | 1090 | (> (nth 2 expr) 1)) |
| 1077 | (math-expand-power (nth 1 expr) (nth 2 expr) | 1091 | (if (= (nth 2 expr) 2) |
| 1078 | nil t)) | 1092 | (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 1 expr)) |
| 1079 | (list '* | 1093 | (list '* (nth 2 (nth 1 expr)) (nth 1 expr)) |
| 1080 | (nth 1 expr) | 1094 | nil (eq (car (nth 1 expr)) '-)) |
| 1081 | (list '^ (nth 1 expr) (1- (nth 2 expr))))) | 1095 | (math-add-or-sub (list '* (nth 1 (nth 1 expr)) |
| 1082 | (if (< (nth 2 expr) 0) | 1096 | (list '^ (nth 1 expr) |
| 1083 | (list '/ 1 (list '^ (nth 1 expr) (- (nth 2 expr)))))))) | 1097 | (1- (nth 2 expr)))) |
| 1098 | (list '* (nth 2 (nth 1 expr)) | ||
| 1099 | (list '^ (nth 1 expr) | ||
| 1100 | (1- (nth 2 expr)))) | ||
| 1101 | nil (eq (car (nth 1 expr)) '-))) | ||
| 1102 | (if (> (nth 2 expr) 0) | ||
| 1103 | (or (and (or (> math-mt-many 500000) (< math-mt-many -500000)) | ||
| 1104 | (math-expand-power (nth 1 expr) (nth 2 expr) | ||
| 1105 | nil t)) | ||
| 1106 | (list '* | ||
| 1107 | (nth 1 expr) | ||
| 1108 | (list '^ (nth 1 expr) (1- (nth 2 expr))))) | ||
| 1109 | (if (< (nth 2 expr) 0) | ||
| 1110 | (list '/ 1 (list '^ (nth 1 expr) (- (nth 2 expr))))))))) | ||
| 1084 | (t expr))) | 1111 | (t expr))) |
| 1085 | 1112 | ||
| 1086 | (defun calcFunc-expand (expr &optional many) | 1113 | (defun calcFunc-expand (expr &optional many) |