Example 2.  Use the adaptive Simpson's rule to compute a numerical approximation to the integral  [Graphics:Images/AdaptiveQuadMod_gr_37.gif].  
Use the tolerances [Graphics:Images/AdaptiveQuadMod_gr_38.gif].  Compare with the analytic or "true value" of the integral.

Solution 2.

[Graphics:../Images/AdaptiveQuadMod_gr_39.gif]
[Graphics:../Images/AdaptiveQuadMod_gr_40.gif]
[Graphics:../Images/AdaptiveQuadMod_gr_41.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_42.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_43.gif]


[Graphics:../Images/AdaptiveQuadMod_gr_44.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_45.gif]


[Graphics:../Images/AdaptiveQuadMod_gr_46.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_47.gif]


[Graphics:../Images/AdaptiveQuadMod_gr_48.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_49.gif]



[Graphics:../Images/AdaptiveQuadMod_gr_50.gif]
[Graphics:../Images/AdaptiveQuadMod_gr_51.gif]



[Graphics:../Images/AdaptiveQuadMod_gr_54.gif]

tol

0.001`

produces

[Graphics:../Images/AdaptiveQuadMod_gr_55.gif]

tol

0.00001`

produces

[Graphics:../Images/AdaptiveQuadMod_gr_56.gif]

tol

1.`*^-7

produces

[Graphics:../Images/AdaptiveQuadMod_gr_57.gif]

true

value

is

[Graphics:../Images/AdaptiveQuadMod_gr_58.gif]

Did the adapt subroutine behave as expected ?

The following graph illustrates the example.

[Graphics:../Images/AdaptiveQuadMod_gr_59.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_60.gif]

[Graphics:../Images/AdaptiveQuadMod_gr_61.gif]
[Graphics:../Images/AdaptiveQuadMod_gr_62.gif]
[Graphics:../Images/AdaptiveQuadMod_gr_63.gif]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004