Example 2. Use the
adaptive Simpson's rule to compute a numerical approximation to the
integral
.
Use the tolerances
. Compare
with the analytic or "true value" of the integral.
Solution 2.
![[Graphics:../Images/AdaptiveQuadMod_gr_42.gif]](../Images/AdaptiveQuadMod_gr_42.gif)
|
tol |
0.001` |
produces |
|
|
tol |
0.00001` |
produces |
|
|
tol |
1.`*^-7 |
produces |
|
|
true |
value |
is |
|
Did the adapt subroutine behave as expected ?
The following graph illustrates the example.
![[Graphics:../Images/AdaptiveQuadMod_gr_59.gif]](../Images/AdaptiveQuadMod_gr_59.gif)
![[Graphics:../Images/AdaptiveQuadMod_gr_60.gif]](../Images/AdaptiveQuadMod_gr_60.gif)
(c) John H. Mathews 2004