Reimann Sums and Integrals with Maple

Maple can do both sums and limits. We give some examples.

> sum(k^2-k,k=1..500);

41666500

> sum(1/k^2,k=1..100);

1589508694133037873112297928517553859702383498543709859889432834803818131090369901/972186144434381030589657976672623144161975583995746241782720354705517986165248000

> evalf(%);

1.634983900

Write out these sums in Sigma notation. Next we do limits.

> limit(tan(3*x)*sin(2*x)/x^2,x=0);

6

> limit((1+2/n)^n, n=infinity);

exp(2)

You of course already knew how to do these! Now watch this:

> limit(sum(1/k^2,k=1..m),m=infinity);

1/6*Pi^2

Now we set up a Reimann sum for the area under x^5 from 2 to 7 using right end points.

Let's do the sum for n=5, n=50, n=100, and n=1000.

> n:=5;

n := 5

> sum((2+i*(5/n))^5*(5/n),i=1..n);

28975

> n:=50;

n := 50

> sum((2+i*(5/n))^5*(5/n),i=1..n);

163569497/8000

> evalf(%);

20446.18712

> n:=100;

n := 100

> evalf(sum((2+i*(5/n))^5*(5/n),i=1..n));

20019.35935

> n:=1000;

n := 1000

> evalf(sum((2+i*(5/n))^5*(5/n),i=1..n));

19639.46234

Now watch this: (We m instead of n, since once we assign n a fixed value, Maple will not let us use it as a varying index.)

> limit(evalf(sum((2+i*(5/m))^5*(5/m),i=1..m)),m=infinity);

19597.50000

We compare with the definite (although you should check this result by hand):

> int(x^5,x=2..7);

39195/2

> evalf(%);

19597.50000

Problem 1: What is the smallest value of n such that this Reimann sum is correct when rounded to one decimal place?

Problem 2: Set up a Reimann sum using the mid points. Now how many terms do you need to be correct when rounded to one decimal place?

Problem 3: Read section 7.7 of your textbook. Use the Trapezoidal Rule to approximate the integral. How many terms to you need to be  correct when rounded to one decimal place?