This worksheet will allow you to investigate left, right and midpoint Riemann sums as well as the sums obtained from the trapezoid and Simpson rules. Each sum will be simplified to a closed-form formula in terms of the number of partitions, n. You can then investigate such issues as what happens to the sum in the limit as n goes to infinity, or how the errors for the different sums change as n changes. The worksheet will also plot the approximations as functions of n to illustrate the convergence rates to the limit.
Larry Riddle, Agnes Scott College, January 2001
Be sure to execute these first two commands before you start.
> restart: with(student):
To investigate your own function, change the example in the next line. The only thing you will need to change in the rest of the worksheet is the lower and upper limits for the integral and each Riemann sum calculation.
> f := x^4-3*x^3-3*x^2+30;
a := 0;
b := 2;
> plot([f,0], x=a..b);
> ans := Int(f, x=a..b): % = value(%);
> LS := leftsum(f, x=a..b, n);
> LEFT(n) := expand(value(LS));
> RS := rightsum(f, x=a..b, n);
> RIGHT(n) := expand(value(RS));
> TRAP(n) := (LEFT(n)+RIGHT(n))/2;
> MS := middlesum(f, x=a..b, n);
> MID(n) := expand(value(MS));
> SIMP(n) := expand((2*MID(n) + TRAP(n))/3);
> plot([LEFT(n), RIGHT(n), SIMP(n)], n=5..100);
> plot([MID(n), TRAP(n), SIMP(n)], n=5..40);