Math 132: Calculus for the Physical & Life Sciences 2 Lab Day 1: Understanding Errors for Approximate Integration Due Friday, February 22, 2008, at the beginning of class.

Background and Goals

We have discussed various methods for approximating definite integrals: left- and righthand Riemann sums (L_{n}, R_{n}), midpoint Riemann sums (M_{n}), the Trapezoidal Rule (T_{n}), and Simpson’s Rule (S_{n}). The main goal of this lab is to study how the error for each of these approximation methods:

Error = Exact Value − Approximate Value.

depends on the number of subdivisions n used to construct the approximation. We also want to understand why the weighted average form of Simpson’s Rule:

S_{2n} = \frac{2}{3}M_{n} + \frac{1}{3}T_{n}  (1)

gives an explanation for why Simpson’s Rule appears to be so much more accurate than the other methods.

Maple Commands

The commands that you will need to use are RiemannSum, ApproximateInt from the Student[Calculus1] package, which you load by typing

with(Student[Calculus1]);

To enter a function, say f(x) = x^{3} − 2x^{2} − 7x + 4, type

f := x-> x^3-2*x^2-7*x+4;

To compute one of the Riemann sum approximations, say the midpoint sum over the interval [−2, 4] with n = 8 subintervals use

evalf(RiemannSum(f(x),x=-2..4,method=midpoint,partition=8));

To compute one of the other approximations, say the Trapezoid Rule over the interval [−2, 4] with n = 8 subintervals, type

evalf(ApproximateInt(f(x),x=-2..4,method=trapezoid,partition=8));

To plot the graph of a function over an interval, use the plot command.

plot(f(x),x=-2..4);

A Comment

As we discussed in class on Wednesday, in Maple, the command ApproximateInt with the method=simpson and partition=n options actually corresponds to the Simpson’s Rule approximation S_{2n} the way we wrote down the formula to start in class. Since the weighted average form (1) of Simpson’s Rule relates S_{2n} to M_{n} and T_{n}, though, we will always take equal partition numbers (n values) for all three methods when making comparisons.

Lab Questions

I. You will first work with the definite integral

∫_{0}^{1} x^{2}\sqrt{4 − x^{2}} dx = \frac{π}{3} − \frac{\sqrt{3}}{4} ≈ 0.6141848494

In Maple, π is entered as Pi and the command sqrt is the square root function.

A) (Do before or after the lab.) Verify the exact value of the integral above, using a trig substitution.

B) Complete Table A on the accompanying sheet for the function f(x) = x^{2}\sqrt{4 − x^{2}} over [0, 1]. (Compute the values using Maple, and fill in the table by hand, recording all decimal places Maple displays.)

C) For each method, when you double n, the error should be (approximately) divided by 2^{p} for some power p. Find that power for each of the methods. Put your results in the Table B on the accompanying page.

D) For each method the error can be estimated as

E(n) ≈ \frac{k}{n^{p}}

where p is the power in the table above and k is some constant. In each method, determine the effect on the error of multiplying n by 10 and put your results in Table C.

E) Take n = 16. How do the errors for the Midpoint Riemann sum M_{n} and the Trapezoidal rule T_{n} compare?

F) Based on your answer to part E, about how large would n have to be for M_{n} to be accurate to 10 decimal places (that is, the error for M_{n} to be less than .5 × 10^{−10}). Compute M_{n} for your n and compare to the exact value.

II. Repeat question I for the integral

∫_{0}^{1} e^{x^{2}} dx

(which cannot be evaluated by means of the Evaluation Theorem because f(x) = e^{x^{2}} has no antiderivative in the class of elementary functions). How will you get an “exact” value to approximate the errors for the four methods for n = 2, 4, 8, 16?

III.

A) (Do before or after lab.) Explain why S_{2n} is always between M_{n} and T_{n}. Hint: Either M_{n} ≤ T_{n} or T_{n} ≤ M_{n}. Consider each case separately.

B) Based on your answers to part A above and parts I E and II E, explain why it is reasonable that Simpson’s Rule should produce much more accurate estimates for the same partitions number n than either the Midpoint Rule or the Trapezoidal rule for the same n. See the weighted average form (1) above.

Approximations for ∫_{0}^{1} x^{2}\sqrt{4 − x^{2}} dx

Table A

n 2 4 8 16

L_{n} E_{left}(n) R_{n} E_{right}(n) M_{n} E_{mid}(n) T_{n} E_{trap}(n) S_{2n} E_{simp}(n)

Table B

Method LEFT RIGHT MID TRAP SIMP
p

Table C

Method  LEFT RIGHT MID TRAP SIMP

Error is divided by:

Approximations for ∫_{0}^{1} e^{x^{2}} dx

Table A

n 2 4 8 16

L_{n} E_{left}(n) R_{n} E_{right}(n) M_{n} E_{mid}(n) T_{n} E_{trap}(n) S_{2n} E_{simp}(n)

Table B

Method LEFT RIGHT MID TRAP SIMP
p

Table C

Method  LEFT RIGHT MID TRAP SIMP

Error is divided by: