diff options
| -rw-r--r-- | lisp/calc/calc-arith.el | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el index 25ccfc48019..9d4d04a5758 100644 --- a/lisp/calc/calc-arith.el +++ b/lisp/calc/calc-arith.el | |||
| @@ -305,6 +305,17 @@ | |||
| 305 | (and (not (Math-scalarp a)) | 305 | (and (not (Math-scalarp a)) |
| 306 | (not (math-known-scalarp a t)))) | 306 | (not (math-known-scalarp a t)))) |
| 307 | 307 | ||
| 308 | (defun math-known-square-matrixp (a) | ||
| 309 | (if (eq (car-safe a) '^) | ||
| 310 | (math-known-square-matrixp (nth 1 a)) | ||
| 311 | (and (math-known-matrixp a) | ||
| 312 | (or (math-square-matrixp a) | ||
| 313 | (and (or | ||
| 314 | (integerp calc-matrix-mode) | ||
| 315 | (eq calc-matrix-mode 'square)) | ||
| 316 | (eq (car-safe a) 'var) | ||
| 317 | (not (math-const-var a))))))) | ||
| 318 | |||
| 308 | ;;; Try to prove that A is a scalar (i.e., a non-vector). | 319 | ;;; Try to prove that A is a scalar (i.e., a non-vector). |
| 309 | (defun math-check-known-scalarp (a) | 320 | (defun math-check-known-scalarp (a) |
| 310 | (cond ((Math-objectp a) t) | 321 | (cond ((Math-objectp a) t) |
| @@ -1869,6 +1880,21 @@ | |||
| 1869 | (cond ((and math-simplify-only | 1880 | (cond ((and math-simplify-only |
| 1870 | (not (equal a math-simplify-only))) | 1881 | (not (equal a math-simplify-only))) |
| 1871 | (list '^ a b)) | 1882 | (list '^ a b)) |
| 1883 | ((and (eq (car-safe a) '*) | ||
| 1884 | (or | ||
| 1885 | (and | ||
| 1886 | (math-known-matrixp (nth 1 a)) | ||
| 1887 | (math-known-matrixp (nth 2 a))) | ||
| 1888 | (and | ||
| 1889 | calc-matrix-mode | ||
| 1890 | (not (eq calc-matrix-mode 'scalar)) | ||
| 1891 | (and (not (math-known-scalarp (nth 1 a))) | ||
| 1892 | (not (math-known-scalarp (nth 2 a))))))) | ||
| 1893 | (if (and (= b -1) | ||
| 1894 | (math-known-square-matrixp (nth 1 a)) | ||
| 1895 | (math-known-square-matrixp (nth 2 a))) | ||
| 1896 | (list '* (list '^ (nth 2 a) -1) (list '^ (nth 1 a) -1)) | ||
| 1897 | (list '^ a b))) | ||
| 1872 | ((and (eq (car-safe a) '*) | 1898 | ((and (eq (car-safe a) '*) |
| 1873 | (or (math-known-num-integerp b) | 1899 | (or (math-known-num-integerp b) |
| 1874 | (math-known-nonnegp (nth 1 a)) | 1900 | (math-known-nonnegp (nth 1 a)) |