Module

for

The adaptive Simpson's rule for quadrature uses the two subroutines "Simpson" and "Adapt."  The program is "recursive".  There is no brake available if something goes wrong, i.e. if a pathological "bad" function is thrown it's way it may proceed on a slippery path of infinite recursion.

``````

``````

Example 1.  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 1.

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.

Example 3.  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 3.

Execute the following Mathematica subroutine, which is the "long version" of the subroutine we have been using previously.

``````
``````

Example 4.  Use the adaptive Simpson's rule to compute a numerical approximation to the integral    that we investigated in example 2.
The long solution is obtained if you add a print statement to investigate the in between computations.
This subroutine is pedagogical and is intended to help us understand what's happening in a recursive program.
You would probably not want to always print out the in between steps, so you might want to re-execute the first version for some of your work.
Solution 4.

Example 5.  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 5.

Example 6.  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 6.

Various Scenarios and Animations for the Adaptive Simpson's Rule.

Example 7.   Let    over  .  Use the adaptive Simpson's rule to approximate the value of the integral.
Solution 7.

(c) John H. Mathews 2004