diff options
| author | Jay Belanger | 2004-11-07 23:33:29 +0000 |
|---|---|---|
| committer | Jay Belanger | 2004-11-07 23:33:29 +0000 |
| commit | 4710da05cb3e569a3701b06b83a16a63cc3ac24c (patch) | |
| tree | 3caa8ea943ecb6ed521c36f9e6a203ac15bc42e7 | |
| parent | 3fc61fde57cae39c7b4c922355ac056b71b17abf (diff) | |
| download | emacs-4710da05cb3e569a3701b06b83a16a63cc3ac24c.tar.gz emacs-4710da05cb3e569a3701b06b83a16a63cc3ac24c.zip | |
(math-linear-subst-tried): New variable.
(math-do-integral): Set `math-linear-subst-tried' to nil.
(math-do-integral-methods): Use `math-linear-subst-tried' to
determine what type of substitution to try.
(math-integ-try-linear-substituion): Set `math-linear-subst-tried' to
t.
| -rw-r--r-- | lisp/calc/calcalg2.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 2a463009e58..7e8484ea79f 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el | |||
| @@ -738,8 +738,12 @@ | |||
| 738 | (setcar (cdr cur-record) 'cancelled))) | 738 | (setcar (cdr cur-record) 'cancelled))) |
| 739 | (math-replace-integral-parts (car expr))))))) | 739 | (math-replace-integral-parts (car expr))))))) |
| 740 | 740 | ||
| 741 | (defvar math-linear-subst-tried t | ||
| 742 | "Non-nil means that a linear substitution has been tried.") | ||
| 743 | |||
| 741 | (defun math-do-integral (expr) | 744 | (defun math-do-integral (expr) |
| 742 | (let (t1 t2) | 745 | (let ((math-linear-subst-tried nil) |
| 746 | t1 t2) | ||
| 743 | (or (cond ((not (math-expr-contains expr math-integ-var)) | 747 | (or (cond ((not (math-expr-contains expr math-integ-var)) |
| 744 | (math-mul expr math-integ-var)) | 748 | (math-mul expr math-integ-var)) |
| 745 | ((equal expr math-integ-var) | 749 | ((equal expr math-integ-var) |
| @@ -977,7 +981,7 @@ | |||
| 977 | 981 | ||
| 978 | ;; Integration by substitution, for various likely sub-expressions. | 982 | ;; Integration by substitution, for various likely sub-expressions. |
| 979 | ;; (In first pass, we look only for sub-exprs that are linear in X.) | 983 | ;; (In first pass, we look only for sub-exprs that are linear in X.) |
| 980 | (or (if math-enable-subst | 984 | (or (if math-linear-subst-tried |
| 981 | (math-integ-try-substitutions expr) | 985 | (math-integ-try-substitutions expr) |
| 982 | (math-integ-try-linear-substitutions expr)) | 986 | (math-integ-try-linear-substitutions expr)) |
| 983 | 987 | ||
| @@ -1189,6 +1193,7 @@ | |||
| 1189 | 1193 | ||
| 1190 | ;;; Look for substitutions of the form u = a x + b. | 1194 | ;;; Look for substitutions of the form u = a x + b. |
| 1191 | (defun math-integ-try-linear-substitutions (sub-expr) | 1195 | (defun math-integ-try-linear-substitutions (sub-expr) |
| 1196 | (setq math-linear-subst-tried t) | ||
| 1192 | (and (not (Math-primp sub-expr)) | 1197 | (and (not (Math-primp sub-expr)) |
| 1193 | (or (and (not (memq (car sub-expr) '(+ - * / neg))) | 1198 | (or (and (not (memq (car sub-expr) '(+ - * / neg))) |
| 1194 | (not (and (eq (car sub-expr) '^) | 1199 | (not (and (eq (car sub-expr) '^) |