diff options
| author | Mattias EngdegÄrd | 2019-09-22 15:03:02 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2019-09-29 13:41:21 +0200 |
| commit | 19405291aa5b1f7de7e44cc2efe384840b144236 (patch) | |
| tree | de07f6ca665f86881ffa7628a165c719fc3b7a11 /lisp | |
| parent | ab2a8f70775ff1c51e3b3b5f7b337c3fe5132db2 (diff) | |
| download | emacs-19405291aa5b1f7de7e44cc2efe384840b144236.tar.gz emacs-19405291aa5b1f7de7e44cc2efe384840b144236.zip | |
Fix linear equation system solving in Calc (bug#35374)
* lisp/calc/calcalg2.el (math-try-solve-for):
To solve Ax^n=0 where A is a nonzero constant and x the variable to
solve for, solve x^n=0 instead of solving A=0 (which obviously fails)
or something equally stupid.
* test/lisp/calc/calc-tests.el (calc-test-solve-linear-system): New.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/calc/calcalg2.el | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 18243bfc749..2a716633ae6 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el | |||
| @@ -2417,6 +2417,12 @@ | |||
| 2417 | ((= (length math-t1) 2) | 2417 | ((= (length math-t1) 2) |
| 2418 | (apply 'math-solve-linear | 2418 | (apply 'math-solve-linear |
| 2419 | (car math-t2) math-try-solve-sign math-t1)) | 2419 | (car math-t2) math-try-solve-sign math-t1)) |
| 2420 | ((= (length math-t1) 1) | ||
| 2421 | ;; Constant polynomial. | ||
| 2422 | (if (eql (nth 2 math-t2) 1) | ||
| 2423 | nil ; No possible solution. | ||
| 2424 | ;; Root of the factor, if any. | ||
| 2425 | (math-try-solve-for (nth 2 math-t2) 0 nil t))) | ||
| 2420 | (math-solve-full | 2426 | (math-solve-full |
| 2421 | (math-poly-all-roots (car math-t2) math-t1)) | 2427 | (math-poly-all-roots (car math-t2) math-t1)) |
| 2422 | (calc-symbolic-mode nil) | 2428 | (calc-symbolic-mode nil) |