\magnification = \magstep1
\centerline{Mathematics 136, section 4 -- AP Calculus}
\centerline{Lab Day 4:  Applications of Integration, Arc Length of Curves}
\centerline{November 5, 2003}
\bigskip
\noindent
{\it Goals}
\bigskip
Today we will learn Maple's commands for definite integration, and 
apply them to some problems about applications of integration.
\bigskip
\noindent
{\it Maple's {\bf int} command}
\bigskip
To do definite integrals in Maple, we will use the {\it int} command.  
For instance, suppose we want
to compute
$$\int_1^2 { x - 4 \over x^2 + 2x + 5}\ dx$$
We can use the command
\medskip
\centerline{\tt int((x-4)/(x\^{}2+2*x+5),x=1..2);}
\medskip
\noindent
(Note the limits of integration are specified as a range
of values of the integration variable, in the 
same format as a range of values for plotting.) Your output from this
command should be
$${1\over 2} \ln(13) - {5 \over 2} \arctan({3\over 2}) - {1\over 2} \ln(8)
+ {5\over 8} \pi$$
As you can verify, this is just the result of applying the 
Fundamental Theorem of Calculus to an antiderivative
of $(x-4)/(x^2+2x+5)$ (the form
is \# 25 from our table of integrals if you complete the 
square in the denominator: $x^2 + 2x + 5 = (x+1)^2 + 4$, and
substitute $u = x+1$ everywhere to convert to an integral
like the table entry).
\bigskip
\item{} {\it Important fact: If Maple can generate an exact, symbolic expression
for a definite integral it will do that and give that as the output,
unless directed otherwise.}
\bigskip
\noindent
If you want a {\it decimal approximation\/} to the value, rather than an 
exact, symbolic expression you can put the whole integrate
command, capitalized to {\tt Int},
``inside'' a call to the {\tt evalf} function:
\medskip
\centerline{\tt evalf(Int((x-4)/(x\^{}2+2*x+5),x=1..2));}
\medskip
\noindent
This will use a numerical method (basically a {\it Riemann sum\/} with varying
$\Delta x$'s chosen to yield an approximation good to 
a large number of decimal places) to compute an approximate value.

Maple can also look for an indefinite integral (it ``knows''
all the methods we have discussed, and then some!).  You
would do that using a similar command, but omitting 
the limits of integration:
\medskip
\centerline{\tt int((x-4)/(x\^{}2+2*x+5),x);}
\medskip
\noindent
(The $x$ in the command specifies the integration variable.
To remember to include it, you can think of the $dx$ in 
our usual way of writing the indefinite integral(!))
\bigskip
\noindent
{\it Lab Questions, part 1}
\bigskip
\item{A)}  Set up the definite integral to compute the 
volume of the solid obtained by rotating the region bounded by
$y = xe^{-x}$, the $x$-axis, $x = 0$, and $x = 1$ about 
the line $y = -2$ in the $xy$-plane.  (What do the cross-sections 
by planes perpendicular to the $x$-axis look like?).
Use Maple to find this volume.
\bigskip
\noindent
{\it Another Application of Integrals -- Background}
\bigskip
Imagine a thin, curved wire in a plane.  A basic measurement problem
is to determine the {\it length\/} of the wire (if possible without
deforming its shape!)  If we knew the density of the wire at
each point, we could also ask what its {\it total mass\/} is.

We can {\it model\/} the shape of the wire 
mathematically by giving  
a curve in the plane -- in simple cases, the graph of a
function $y = f(x)$ for $x \in [a,b]$.  The length of the graph (measured
``along the curve'') is called its {\it arc length\/}.
 Today we will learn how to compute
the {\it arc length\/} of a graph in mathematical terms.  As with other
problems we have studied, the basic approach is to {\it subdivide and
approximate}.  Suppose we subdivide $[a,b]$ into $n$ smaller intervals
with endpoints
$$a=x_0 < x_1 < x_2 < \cdots < x_{n-1} < x_n = b$$
If $\Delta x$ is small enough (and $f$ is a ``nice'' function), the
segment $s_i$ of the graph from $(x_{i-1},f(x_{i-1}))$ to $(x_{i},f(x_{i}))$
will be {\it nearly straight}, hence can be approximated by a 
the straight line segment $\ell_i$ joining the two points on the graph.  Writing
$\Delta y_i = f(x_i) - f(x_{i-1})$, we have by the Pythagorean theorem:
$$\eqalign{{\rm length\ of\ } s_i &\doteq \sqrt{\Delta x^2 + \Delta y_i^2}\cr
    &= \sqrt{1 + \left({\Delta y_i\over\Delta x}\right)^2}\cdot \Delta x.\cr}$$
So the total length is approximated by a sum 
$${\rm total\ length} \doteq \sum_{i=1}^n\sqrt{1+\left({\Delta y_i\over\Delta x}\right)^2}\cdot \Delta x$$
Even though this is not exactly a Riemann sum as it stands
(because the expression 
${\Delta y_i\over\Delta x}$ is not formed by evaluating a particular 
function at a chosen point $x_i^*$), it is still true that
as $n \to \infty$ and $\Delta x \to 0$ the limit of this sum gives a 
definite integral.  Since 
$$\lim_{\Delta x \to 0} {\Delta y_i\over\Delta x} = f'(x),$$ 
the derivative of $f$,
the integral for arclength of the graph $y = f(x)$ is
$${\rm arc\ length} = \int_a^b \sqrt{1 + (f'(x))^2}\ dx$$
\bigskip
\noindent
{\it A Worked Example}
\bigskip
Suppose we wanted to find the arc length of $y = f(x) = (e^x + e^{-x})/2$
from $x = 0$ to $x = 1$.  We can use Maple to attack this as follows.
First we can define the function $f(x)$ using
\medskip
\centerline{\tt f := (exp(x) + exp(-x))/2;}
\medskip
\noindent

Then the arclength integral (indefinite) is 
\medskip
\centerline{\tt int(sqrt(1 + diff(f,x)\^{}2),x);}
\medskip
\noindent
Maple should give you as output:
$${1\over 2}e^x - {1\over 2}{1\over e^x}$$
This is one of the (rare!!) cases where an arclength integral actually
has an elementary antiderivative.  If you enter the Maple command
to find the definite integral:
\medskip
\centerline{\tt int(sqrt(1 + diff(f,x)\^{}2),x=0..1);}
\medskip
\noindent
then Maple will use the Fundamental Theorem of Calculus and the indefinite
integral above to compute the definite integral.  

\bigskip
{\it In most cases, this will not be possible, though, and the best 
we will be able to do is to generate a numerical appoximation
to the arclength, using a command of the form:}
\medskip
\centerline{\tt evalf(Int(sqrt(1 + diff(f,x)\^{}2),x=a..b));}
\medskip
\noindent
{\it This command instructs Maple to approximate the definite 
integral using a Riemann sum method as discussed above.}

\bigskip
For instance, if you do this on the integral above, you should get 
a numerical approximation $1.175201194$ to 
$$\int_0^1 \sqrt{1 + (f'(x))^2}\ dx$$
for $f(x) = (e^x + e^{-x})/2$.
\bigskip
\noindent
{\it Lab Questions, part 2}
\bigskip
\item{B)}  Using Maple as above, get decimal numerical 
approximation the length of the 
graphs $y = x^n$, $x = 0$ to $x = 1$, for $n = 1,2,10,20,100$.
Discuss any patterns or trends you see in the calculations. 
In particular, can you guess something about the arc lengths
of the graphs $y = x^n$, ($x = 0$ to $x = 1$), as $n \to \infty$?  
Plotting the graphs
$y = x^n$, $n = 1,2,10,20,100$
together may help to visualize and/or explain this.

\bigskip
\item{C)}  A thin wire in the shape of the graph $y = x^3$, $x \in [-1,1]$
(in cm's)
has density $d(x) = 3+x$ g/cm at the point $(x,x^3)$.  
\itemitem{1)} Develop, and {\it fully explain\/} in your solution, a method
for approximating the {\it total mass of the wire\/} using the 
ideas about arclength above.  Note that different portions of the 
wire will have different densities.  Hence segments of the same 
length can have different masses.
\itemitem{2)} Use your method
and Maple to approximate the total mass.  ({\it Answer:} $\doteq 9.29$ g)
\bigskip
\noindent
{\it Lab Assignment:}  Writeups for questions A), B), C) 
as a Maple worksheet, due in class on Monday, November 10.
\bye

