\magnification = \magstep1
\centerline{Mathematics 134 -- Intensive Calculus For Science 2}
\centerline{Lab Day 3:  Applications of Integration: Arc Length of Curves}
\centerline{\it February 27, 2002}
\bigskip
\bigskip
\noindent
{\it 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!)  
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 use Maple to compute
the {\it arc length\/} of some graphs.  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.
If $\Delta x$ is small enough (and $f$ is a ``nice'' function)
the segment of the graph between $x$ and $x + \Delta x$
will be {\it nearly straight}, hence can be approximated by a 
the straight line segment joining the two points on the graph.  Writing
$\Delta y = f(x + \Delta x) - f(x)$, we have by the Pythagorean theorem:
$$\eqalign{{\rm length\ of\ segment} &\doteq \sqrt{\Delta x^2 + \Delta y^2}\cr
    &= \sqrt{1 + \left({\Delta y\over\Delta x}\right)^2}\cdot \Delta x.\cr}$$
So the total length is approximated by a sum 
$${\rm total\ length} = \sum \sqrt{1+\left({\Delta y\over\Delta x}\right)^2}\cdot \Delta x$$
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\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 More about the {\tt int} Command in Maple}
\bigskip
\noindent
{\it 1. Indefinite Integrals}
\bigskip
To ask Maple calculate an indefinite integral such as 
$$\int { x - 4 \over x^2 + 2x + 5}\ dx$$
we could use a command such as
\medskip
\centerline{\tt int((x-4)/(x\^{}2+2*x+5),x);}
\medskip
\noindent
Maple knows all of our basic antiderivative rules, plus
a large table of integrals (much more extensive than the one
in our textbook).
Try this and differentiate the output by hand to 
check that it is correct.  (Note: by completing the 
square, $x^2 + 2x + 5 = (x+1)^2 + 4$ which has no real roots.
This is an integral of the form \# 25 from the table in the text, 
if you substitute $u = x+1$ and convert the entire integrand to an expression
in $u$.)

\bigskip
The general format of the indefinite integral command is
\medskip
\centerline{\tt int(expression,var);}
\medskip
\noindent
where {\tt expression} is the formula for the integrand, and 
{\tt var} is the variable you are integrating with respect to.  (It may 
help to think of this as corresponding to the ``$dx$'' in the 
mathematical notation.)  The variable can be any variable appearing 
(or not) in the expression. 

\bigskip
On many examples, Maple will not be able to do anything 
to get an indefinite integral in terms of the usual elementary functions.
When this happens it will just echo your input.  (For instance, 
you can try $\int e^{x^4} dx$.)  In {\it some cases}, doing some
preliminary substitution ``by hand'' will give Maple something it
can work with.  But be aware that even though some functions 
can be handled by our general methods (and others we have not 
discussed), {\it very few functions actually
have elementary antiderivatives.\/}  

\bigskip
\noindent
{\it 2. Definite Integrals}
\bigskip
To do definite integrals in Maple, you use the same {\it int} command, 
but in a slightly different format.  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 added to the previous command, in the 
same format as a range of values for plotting.) Your output from this
command should be equivalent to
$${1\over 2} \ln(13) - {5 \over 2} \arctan({3\over 2}) - {1\over 2} \ln(8)
+ {5\over 8} \pi$$
As you can easily verify, this is just the result of applying the 
Fundamental Theorem of Calculus with the antiderivative (indefinite
integral) from before.
\bigskip
\item{} {\it 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 {\tt int}
command from above ``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 very accurate numerical method  to compute an approximate 
value.

\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
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}
\bigskip
\item{A)}  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$.

\bigskip
\item{B)}  For which of the $n$'s in question A is there an 
elementary antiderivative for the arc length integrand
$\sqrt{1 + (nx^{n-1})^2}$ (or at least one that Maple can find)? 

\bigskip
\item{C)}  Discuss any patterns or trends you see in the calculations
in question A.  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
\noindent
{\it Lab Assignment}  

Writeups for questions A) - C) due in 
class on Wednesday, March 13.
\bye

