Mathematics 134–Intensive Calculus for Science 2 Lab 1 – Riemann Sums and the Definite Integral January 18, 2002

Background

In class, we have introduced the left- and right-hand sums for a function f on an interval [a, b], with a given number of subdivisions n, and a step-size Δt = \frac{b−a}{n}:

Left − hand sum = f(t_{0})Δt + ⋯ + f(t_{n−1})Δt = ∑_{i=0}^{n−1} f(t_{i})Δt

Right − hand sum = f(t_{1})Δt + ⋯ + f(t_{n})Δt = ∑_{i=1}^{n} f(t_{i})Δt

We can also do the same sort of thing evaluating f at the midpoint of each smaller interval to get the midpoint sum. All of these are examples of Riemann sums for f.

If f is a continuous function, then the definite integral of f is obtained by letting the number n of subdivisions grow without any bound:

∫_{a}^{b} f(t) dt = lim_{n→∞} ∑_{i=0}^{n−1} f(t_{i})Δt = lim_{n→∞} ∑_{i=1}^{n} f(t_{i})Δt

Today, we want to use some features of Maple to visualize these sums, and the limiting process that yields the value of the definite integral.

New Maple

We will be using several commands in the Maple student package in this lab. To make these available, you will need to start by entering the command:

                              with(student);

to load the student package. The output will be the list of commands included in this package. The ones we will use in the lab are:

• leftbox, middlebox, rightbox which draw graphical representations of the left-, midpoint, and right-hand Riemann sums for a given function, and

• leftsum, middlesum, rightsum which compute the left-, midpoint, and right-hand Riemann sums of a given function (as formulas). For instance, try entering the following commands to see the pictures for the left- and right-hand sums for f(x) = t^{2}−3t+4 on [a, b] = [0, 2] with n = 5 subdivisions:

                     leftbox(t^2 - 3*t + 4, t=0..2,5);
                    rightbox(t^2 - 3*t + 4, t=0..2,5);

To see the numerical values of the left- and right-hand sums, you can enter commands like this:

         evalf(leftsum(t^2 - 3*t + 4, t=0..2, 5));
         evalf(rightsum(t^2 - 3*t + 4, t=0..2, 5));

If you leave off the evalf( ) around the leftsum or rightsum, can you see what the output means?

As you can probably guess now, the format for all of these commands is: the command name, open paren, the formula for the function f, comma, t =, then the endpoints, separated by two periods, another comma, then the number n, followed by the close paren, then the semicolon.

Lab Questions

A) In this question you will consider f(x) = 4^{x} on the interval [a, b] = [0, 2].

1) Using the leftbox and rightbox commands, draw the graphics for the Riemann sums on [0, 2] with n = 5, 20, 50. Does it seem reasonable that both left- and right-hand sums will tend to the same limit as n → ∞? Explain in a text region. Also resize your graphs before printing out your worksheet. Try to get all these graphs on one page(!)

2) Using the leftsum and rightsum commands, compute the numerical values of the sums with n = 5, 20, 50. How does these results compare to what you said in part 1?

3) As we saw in class Wednesday, because 4^{x} is increasing on the interval,

Right − hand sum − Left − hand sum = (f(2) − f(0))Δt = (f(2) − f(0)) · \frac{2 − 0}{n}

and the actual value of the definite integral is somewhere in between the left- and right-hand sum values. How big must n be taken so that the left- and right-hand sums differ by no more than .0001? Using your value n, compute the values of the left- and right-hand sums to check your answer.

4) Now, compute the midpoint sum with n = 200. How close is this result to what you had in part 3? What does this say about the numbers of subdivisions needed to approximate ∫_{0}^{2} 4^{t} dt closely with the different methods?

B) Compute the left-, midpoint, and right-hand sums with n = 5, 20, 50, 500, 1000 for each of the following integrals. (No graphics for these, please – just the numerical values.) Observe the limit two which your sums seem to be tending as n increases, and estimate the value of the definite integrals. Also compare the rates at which each of the three methods seem to be approaching this limit. Is one getting there faster (i.e. closer to the limit for smaller n) than the others?

1)

∫_{0}^{1} sin(t^{3} − 2t) dt

(In Maple, the function is sin(t^3 - 2*t).) 2)

∫_{−1}^{1} e^{−t^{2}} dt

(In Maple, the function is exp(-t^2).) Assignment

Individual writeups, due in class Friday, January 25.