Function: math-integrate-by-parts

math-integrate-by-parts is a byte-compiled function defined in calcalg2.el.gz.

Signature

(math-integrate-by-parts U VPRIME)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calcalg2.el.gz
(defun math-integrate-by-parts (u vprime)
  (let ((math-integ-level (if (or math-good-parts
				  (math-polynomial-p u math-integ-var))
			      math-integ-level
			    (1- math-integ-level)))
	;; (math-doing-parts t) ;Unused
	v temp)
    (and (>= math-integ-level 0)
	 (unwind-protect
	     (progn
	       (setcar (cdr math-cur-record) 'parts)
	       (math-tracing-integral "Integrating by parts, u = "
				      (math-format-value u 1000)
				      ", v' = "
				      (math-format-value vprime 1000)
				      "\n")
	       (and (setq v (math-integral vprime))
		    (setq temp (calcFunc-deriv u math-integ-var nil t))
		    (setq temp (let ((math-prev-parts-v v))
				 (math-integral (math-mul v temp) 'yes)))
		    (setq temp (math-sub (math-mul u v) temp))
		    (if (eq (nth 1 math-cur-record) 'parts)
			(calcFunc-expand temp)
		      (setq v (list 'var 'PARTS math-cur-record)
			    temp (let (calc-next-why)
                                   (math-simplify-extended
                                    (math-solve-for (math-sub v temp) 0 v nil)))
                            temp (if (and (eq (car-safe temp) '/)
                                          (math-zerop (nth 2 temp)))
                                     nil temp)))))
	   (setcar (cdr math-cur-record) 'busy)))))