Mathematics 371 -- Numerical Analysis
Adaptive Quadrature
November 7, 2001
An example: f( x ) = . This is a good candidate for adaptive
quadrature over an interval like [1,3] since the graph of the function is slowly varying
over portions of the interval and rapidly varying over others:
> f:=x->100*x^2*exp(-4*x)*sin(10/x);
> plot(f(x),x=1..3);
>
Here is a listing of the Maple code for Adaptive Quadrature
> interface(verboseproc=2):
> read `/home/fac/little/public_html/Num01/Adapt.map`;
> print(Adapt);
Using adaptive quadrature:
> count := 0;
> approx1:=Adapt(f,1.0,3.0,.00005,true);
"starting integration on [", 1.0, 3.0, "]"
"starting integration on [", 1.0, 2.000000000, "]"
"starting integration on [", 1.0, 1.500000000, "]"
"starting integration on [", 1.0, 1.250000000, "]"
"starting integration on [", 1.0, 1.125000000, "]"
"starting integration on [", 1.0, 1.062500000, "]"
"tolerance met"
"starting integration on [", 1.062500000, 1.125000000, "]"
"tolerance met"
"starting integration on [", 1.125000000, 1.250000000, "]"
"tolerance met"
"starting integration on [", 1.250000000, 1.500000000, "]"
"starting integration on [", 1.250000000, 1.375000000, "]"
"tolerance met"
"starting integration on [", 1.375000000, 1.500000000, "]"
"tolerance met"
"starting integration on [", 1.500000000, 2.000000000, "]"
"starting integration on [", 1.500000000, 1.750000000, "]"
"tolerance met"
"starting integration on [", 1.750000000, 2.000000000, "]"
"tolerance met"
"starting integration on [", 2.000000000, 3.0, "]"
"starting integration on [", 2.000000000, 2.500000000, "]"
"tolerance met"
"starting integration on [", 2.500000000, 3.0, "]"
"tolerance met"
Maple's computed value:
> exact:=evalf(Int(f(x),x=1..3));
> err:=abs(exact1-approx1);
The number of times the Adapt procedure was called recursively:
> count;
CAUTION: It is not the case that the error from the adaptive
quadrature procedure will always be less than or equal to the
error tolerance value (even ignoring round-off error phenomena).
(The derivation of the error estimate uses the assumption that two
values of the fourth derivative of f are equal, which may be far
from true.) For example:
> approx:=Adapt(f,1.0,3.0,.0001,false);
> abs(approx-exact);
Note that the actual error is larger than the error tolerance in this case.