\magnification=\magstep1
\centerline{Mathematics 134--Intensive Calculus for Science 2}
\centerline{Lab 1 -- Riemann Sums and the Definite Integral}
\centerline{\it January 18, 2002}
\bigskip
\noindent
{\it Background}
\bigskip
In class, we have introduced the {\it 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 $\Delta t = {b-a\over n}$:
$$\eqalign{
{\rm Left-hand\ sum} &= f(t_0)\Delta t + \cdots + f(t_{n-1})\Delta t = \sum_{i=0}^{n-1}f(t_i)\Delta t\cr
{\rm Right-hand\ sum} &= f(t_1)\Delta t + \cdots + f(t_n)\Delta t = \sum_{i=1}^nf(t_i)\Delta t\cr}$$
We can also do the same sort of thing evaluating $f$ at the midpoint
of each smaller interval to get the {\it midpoint sum}.  All of these
are examples of {\it Riemann sums} for $f$.

If $f$ is a continuous function, then the {\it definite integral} of 
$f$ is obtained by letting the number $n$ of subdivisions grow without 
any bound:
$$\int_a^b f(t)\ dt = \lim_{n\to\infty} \sum_{i=0}^{n-1}f(t_i)\Delta t = 
\lim_{n\to\infty} \sum_{i=1}^{n}f(t_i)\Delta 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.
\bigskip
\noindent
{\it New Maple}
\bigskip
We will be using several commands in the Maple {\tt student} package
in this lab.  To make these available, you will need to start
by entering the command:
\medskip
\centerline{\tt with(student);}
\medskip
\noindent
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:
\bigskip
\item{$\bullet$} {\tt leftbox, middlebox, rightbox} which draw
graphical representations of the left-, midpoint, and right-hand 
Riemann sums for a given function, and
\item{$\bullet$} {\tt 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:
\medskip
\centerline{\tt leftbox(t\^{}2 - 3*t + 4, t=0..2,5);}
\centerline{\tt rightbox(t\^{}2 - 3*t + 4, t=0..2,5);}
\medskip
\noindent
To see the numerical values of the left- and right-hand sums, you 
can enter commands like this:
\medskip
\centerline{\tt evalf(leftsum(t\^{}2 - 3*t + 4, t=0..2, 5));}
\centerline{\tt evalf(rightsum(t\^{}2 - 3*t + 4, t=0..2, 5));}
\medskip
\noindent
If you leave off the {\tt evalf( )} around the {\tt leftsum}
or {\tt 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.
\bigskip
\noindent
{\it Lab Questions}
\bigskip
\item{A)}  In this question you will consider $f(x)=4^x$ on the 
interval $[a,b]=[0,2]$.
\medskip
\itemitem{1)} Using the {\tt leftbox} and {\tt 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 \to \infty$?  Explain in a text region.  Also
{\it resize your graphs} before printing out your worksheet.  Try to get
all these graphs on one page(!)
\itemitem{2)} Using the {\tt leftsum} and {\tt 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?
\itemitem{3)} As we saw in class Wednesday, because $4^x$
is increasing on the interval, 
$${\rm Right-hand\ sum} - {\rm Left-hand\ sum} = (f(2) - f(0))\Delta t = 
(f(2) - f(0))\cdot {2-0\over 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.
\itemitem{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
$\int_0^2 4^t\ dt$ closely with the different methods?
\bigskip
\item{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 {\it 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?
\medskip
\itemitem{1)} $$\int_0^1 \sin(t^3 - 2t)\ dt$$  
(In Maple, the function is {\tt sin(t\^{}3 - 2*t)}.)
\itemitem{2)} $$\int_{-1}^{1} e^{-t^2}\ dt$$
(In Maple, the function is {\tt exp(-t\^{}2)}.)
\bigskip
\noindent
{\it Assignment}
\bigskip
Individual writeups, due in class Friday, January 25.
\bye


