Function: math-ninteg-midpoint
math-ninteg-midpoint is an autoloaded and byte-compiled function
defined in calcalg3.el.gz.
Signature
(math-ninteg-midpoint EXPR LO HI MODE)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calcalg3.el.gz
(defun math-ninteg-midpoint (expr lo hi mode) ; uses "math-ninteg-temp"
(if (eq mode 'inf)
(let (;; (math-infinite-mode t) ;Unused!
temp)
(setq temp (math-div 1 lo)
lo (math-div 1 hi)
hi temp)))
(if math-ninteg-temp
(let* ((it3 (* 3 (car math-ninteg-temp)))
(math-working-step-2 (* 2 (car math-ninteg-temp)))
(math-working-step 0)
(range (math-sub hi lo))
(del (math-div range (math-float it3)))
(del2 (math-add del del))
(del3 (math-add del del2))
(x (math-add lo (math-mul '(float 5 -1) del)))
(sum '(float 0 0))
(j 0) temp)
(while (<= (setq j (1+ j)) (car math-ninteg-temp))
(setq math-working-step (1+ math-working-step)
temp (math-ninteg-evaluate expr x mode)
math-working-step (1+ math-working-step)
sum (math-add sum (math-add temp (math-ninteg-evaluate
expr (math-add x del2)
mode)))
x (math-add x del3)))
(setq math-ninteg-temp (list it3
(math-add (math-div (nth 1 math-ninteg-temp)
'(float 3 0))
(math-mul sum del)))))
(setq math-ninteg-temp (list 1 (math-mul
(math-sub hi lo)
(math-ninteg-evaluate
expr
(math-mul (math-add lo hi) '(float 5 -1))
mode)))))
(nth 1 math-ninteg-temp))