Function: math-integ-try-parts
math-integ-try-parts is a byte-compiled function defined in
calcalg2.el.gz.
Signature
(math-integ-try-parts EXPR &optional GOOD-PARTS)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calcalg2.el.gz
(defun math-integ-try-parts (expr &optional good-parts)
;; Integration by parts:
;; integ(f(x) g(x),x) = f(x) h(x) - integ(h(x) f'(x),x)
;; where h(x) = integ(g(x),x).
(let ((math-good-parts good-parts))
(or (let ((exp (calcFunc-expand expr)))
(and (not (equal exp expr))
(math-integral exp)))
(and (eq (car expr) '*)
(let ((first-bad (or (math-polynomial-p (nth 1 expr)
math-integ-var)
(equal (nth 2 expr) math-prev-parts-v))))
(or (and first-bad ; so try this one first
(math-integrate-by-parts (nth 1 expr) (nth 2 expr)))
(math-integrate-by-parts (nth 2 expr) (nth 1 expr))
(and (not first-bad)
(math-integrate-by-parts (nth 1 expr) (nth 2 expr))))))
(and (eq (car expr) '/)
(math-expr-contains (nth 1 expr) math-integ-var)
(let ((recip (math-div 1 (nth 2 expr))))
(or (math-integrate-by-parts (nth 1 expr) recip)
(math-integrate-by-parts recip (nth 1 expr)))))
(and (eq (car expr) '^)
(math-integrate-by-parts (math-pow (nth 1 expr)
(math-sub (nth 2 expr) 1))
(nth 1 expr))))))