738 |
(setcar (cdr cur-record) 'cancelled))) |
(setcar (cdr cur-record) 'cancelled))) |
739 |
(math-replace-integral-parts (car expr))))))) |
(math-replace-integral-parts (car expr))))))) |
740 |
|
|
741 |
|
(defvar math-linear-subst-tried t |
742 |
|
"Non-nil means that a linear substitution has been tried.") |
743 |
|
|
744 |
(defun math-do-integral (expr) |
(defun math-do-integral (expr) |
745 |
(let (t1 t2) |
(let ((math-linear-subst-tried nil) |
746 |
|
t1 t2) |
747 |
(or (cond ((not (math-expr-contains expr math-integ-var)) |
(or (cond ((not (math-expr-contains expr math-integ-var)) |
748 |
(math-mul expr math-integ-var)) |
(math-mul expr math-integ-var)) |
749 |
((equal expr math-integ-var) |
((equal expr math-integ-var) |
981 |
|
|
982 |
;; Integration by substitution, for various likely sub-expressions. |
;; Integration by substitution, for various likely sub-expressions. |
983 |
;; (In first pass, we look only for sub-exprs that are linear in X.) |
;; (In first pass, we look only for sub-exprs that are linear in X.) |
984 |
(or (if math-enable-subst |
(or (math-integ-try-linear-substitutions expr) |
985 |
(math-integ-try-substitutions expr) |
(math-integ-try-substitutions expr) |
|
(math-integ-try-linear-substitutions expr)) |
|
986 |
|
|
987 |
;; If function has sines and cosines, try tan(x/2) substitution. |
;; If function has sines and cosines, try tan(x/2) substitution. |
988 |
(and (let ((p (setq rat-in (math-expr-rational-in expr)))) |
(and (let ((p (setq rat-in (math-expr-rational-in expr)))) |
1192 |
|
|
1193 |
;;; Look for substitutions of the form u = a x + b. |
;;; Look for substitutions of the form u = a x + b. |
1194 |
(defun math-integ-try-linear-substitutions (sub-expr) |
(defun math-integ-try-linear-substitutions (sub-expr) |
1195 |
|
(setq math-linear-subst-tried t) |
1196 |
(and (not (Math-primp sub-expr)) |
(and (not (Math-primp sub-expr)) |
1197 |
(or (and (not (memq (car sub-expr) '(+ - * / neg))) |
(or (and (not (memq (car sub-expr) '(+ - * / neg))) |
1198 |
(not (and (eq (car sub-expr) '^) |
(not (and (eq (car sub-expr) '^) |