Symbolic Riemann Sums

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;

f := x^4-3*x^3-3*x^2+30
a := 0
b := 2

> plot([f,0], x=a..b);

[Maple Plot]

> ans := Int(f, x=a..b): % = value(%);

Int(x^4-3*x^3-3*x^2+30,x = 0 .. 2) = 232/5

> LS := leftsum(f, x=a..b, n);

LS := 2*Sum(16*j^4/(n^4)-24*j^3/(n^3)-12*j^2/(n^2)+...

> LEFT(n) := expand(value(LS));

LEFT(n) := 232/5+20/n-16/3*1/(n^2)-16/15*1/(n^4)

> RS := rightsum(f, x=a..b, n);

RS := 2*Sum(16*j^4/(n^4)-24*j^3/(n^3)-12*j^2/(n^2)+...

> RIGHT(n) := expand(value(RS));

RIGHT(n) := -20*1/n+232/5-16/3*1/(n^2)-16/15*1/(n^4...

> TRAP(n) := (LEFT(n)+RIGHT(n))/2;

TRAP(n) := 232/5-16/3*1/(n^2)-16/15*1/(n^4)

> MS := middlesum(f, x=a..b, n);

MS := 2*Sum(16*(j+1/2)^4/(n^4)-24*(j+1/2)^3/(n^3)-1...

> MID(n) := expand(value(MS));

MID(n) := 232/5+8/3/(n^2)+14/15/(n^4)

> SIMP(n) := expand((2*MID(n) + TRAP(n))/3);

SIMP(n) := 232/5+4/15/(n^4)

> plot([LEFT(n), RIGHT(n), SIMP(n)], n=5..100);

[Maple Plot]

> plot([MID(n), TRAP(n), SIMP(n)], n=5..40);

[Maple Plot]