Function: math-ninteg-romberg

math-ninteg-romberg is an autoloaded and byte-compiled function defined in calcalg3.el.gz.

Signature

(math-ninteg-romberg FUNC EXPR LO HI MODE)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calcalg3.el.gz
(defun math-ninteg-romberg (func expr lo hi mode)
  (let ((curh '(float 1 0))
	(h nil)
	(s nil)
	(j 0)
	(ss nil)
	(prec calc-internal-prec)
	(math-ninteg-temp nil))
    (math-with-extra-prec 2
      ;; Limit on "j" loop must be 14 or less to keep "it" from overflowing.
      (or (while (and (null ss) (<= (setq j (1+ j)) 8))
	    (setq s (nconc s (list (funcall func expr lo hi mode)))
		  h (nconc h (list curh)))
	    (if (>= j 3)
		(let ((res (math-poly-interp h s '(float 0 0) nil)))
		  (if (math-lessp (math-abs (nth 1 res))
				  (calcFunc-scf (math-abs (car res))
						(- prec)))
		      (setq ss (car res)))))
	    (if (>= j 5)
		(setq s (cdr s)
		      h (cdr h)))
	    (setq curh (math-div-float curh '(float 9 0))))
	  ss
	  (math-reject-arg nil "*Integral failed to converge")))))