adaptsim
and adaptlob
approximate the integral of the
function f
using adaptive Simpson and Lobatto rule.
Both methods can deal with discontinuous functions.
adaptlob
is more efficient than adaptsim
when the accuracy requirement
is high. For lower tolerances, adaptsim
is generally (but not
always) more efficient than adaptlob
, but less reliable. Both routines show excellent response to changes in the tolerance.
The function f
must return a vector of output values if given a
vector of input values.
adapt...(f,a,b)
approximates the integral of f(x)
from a
to b
to machine precision.
adapt...(f,a,b,tol)
integrates to a relative error of tol.
adapt...(f,a,b,tol,trace)
displays the left end point of the current interval, the interval length, and the partial integral.
adapt...(f,a,b,tol,trace,P1,P2,...)
allows coefficients P1,
... to be passed directly to the function f: g <-
f(x,P1,P2,...)