Lab for Simpson's Quadrature Rule

Module for Simpson's Rule

   Check out the new Numerical Analysis Projects page.

Composite Simpson Quadrature Rule for Numerical Integration. To approximate the integral
[Graphics:sq.txtgr1.gif][Graphics:sq.txtgr2.gif]
by sampling f(x) at the 2m+1 equally spaced points [Graphics:sq.txtgr3.gif].

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr4.gif]
 

Report to be handed in.

Computer project.


Consider the following function used by chemists [Graphics:sq.txtgr6.gif].
Using the Fundamental Theorem of Calculus, we see that the value of the function [Graphics:sq.txtgr7.gif]
is the integral of [Graphics:sq.txtgr8.gif] over the integral 0 <= t <= x.

Use the composite Simpson rule to construct numerical approximations to
[Graphics:sq.txtgr9.gif]

Exercise 1. First define f[t] and be sure to include the definition when t = 0.0

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr10.gif]

Exercise 2. Plot f[t] for 0 <= t <= 5 . Estimate the area under the curve y = f[t] for 0 <= t <= 5

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr11.gif]

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr12.gif]

Exercise 3. In order to apply Simpson's Rule it is desirable that f(t) be continuous. We defined f(0) = 0.
Did this make f(t) continuous at t = 0 ? Why ? Find [Graphics:sq.txtgr13.gif].

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr14.gif]

Exercise 4. Use the composite Simpson rule with h = 0.5 and numerically approximate values for g(1), g(2), g(3), g(4) and g(5). Show the details for finding g(1) and g(2).

Use the composite Simpson rule to construct a numerical approximations to
[Graphics:sq.txtgr15.gif].

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr16.gif]

Use the composite Simpson rule to construct a numerical approximations to
[Graphics:sq.txtgr17.gif].

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr18.gif]

Now use the subroutine for the computations and numerically approximate values for g(1), g(2), g(3), g(4) and g(5).

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr19.gif]
[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr20.gif]
[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr21.gif]

Use the six points (0,g(0)), (1,g(1)), (2,g(2)), (3,g(3)), (4,g(4)), (5, g(5)) and plot a crude graph
of y=g(x).

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr22.gif]

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr23.gif]

Exercise 5. Use the composite Simpson rule with h = 0.25 and numerically approximate values for g(1), g(2), g(3), g(4) and g(5). Show the details for finding g(1) and g(2).

Use the composite Simpson rule to construct a numerical approximations to
[Graphics:sq.txtgr24.gif].

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr25.gif]

Use the composite Simpson rule to construct a numerical approximations to
[Graphics:sq.txtgr26.gif].

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr27.gif]

Now use the subroutine for the computations and numerically approximate values for g(1), g(2), g(3), g(4) and g(5).

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr28.gif]
[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr29.gif]
[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr30.gif]

Exercise 6. An accurate answer requires that many subintervals be used in the composite Simpson Rule.
Use the composite Simpson Rule and find numerically approximations for [Graphics:sq.txtgr31.gif] using the step sizes
h = 0.5, 0.25, 0.125, 0.0625, 0.03125
The approximations should improve when more subintervals are used.

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr32.gif]

Exercise 7. Assume that [Graphics:sq.txtgr33.gif]. Find the absolute errors for the above approximations.

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr34.gif]
[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr35.gif]

Exercise 8. The remainder term for the composite Simpson rule is [Graphics:sq.txtgr36.gif].
Does the absolute error found in 7. exhibit the pattern expected ? Why ?

Yes. Because the error decreases by approximately 1/16 when the step size is cut in half.

[Graphics:sq.txtgr5.gif][Graphics:sq.txtgr37.gif]
 
 

 

 

(c) John H. Mathews, 1998