\documentclass{article}
\usepackage{graphicx}

\begin{document}
\begin{center}
{\bf Lab 1:  Taylor Approximations to Functions}
\end{center}

\section{Introduction to the Lab}
In the pre-lab, we discussed the Taylor expansion for a function at a
point, $x=a$ as:
$$
f(x)=f(a)+f'(a)(x-a)+\frac{f''(a)}{2!}(x-a)^2+\frac{f'''(a)}{3!}(x-a)^3+\ldots
$$
We can view this as a decomposition of $f(x)$ into pieces, or {\it
building blocks}.  That is, the building blocks are a constant, a
line, a parabola, a cubic, etc.  

In the lab, we will:
\begin{enumerate}
\item Investigate a special function which is NOT representable by its
Taylor series.  This will also show what needs to happen in order for
a function to be representable by its power series.
\item Introduce multivariate Taylor Series, and compare the multivariate
polynomial to the original graph.
\end{enumerate}

Here we go!
\section{The Lab}
\begin{enumerate}
\item Consider the function:
$$
f(x)=\left\{ \begin{array}{rl}
{\rm e}^{-\frac{1}{x^2}}, &\mbox{ if } x \neq 0\\
0 & \mbox{ if } x=0
\end{array}\right.
$$
\begin{enumerate}
\item Compute the derivative of $f$ if $x\neq 0$,  and at $x=0$.
Note:  Be careful at $x=0$!  You can use Maple to compute any
limits you need.
\item Compute the second derivative of $f$, again for the two cases.
\item Compute the third derivative of $f$, again for the two cases.
\item Based on these computations, what do you think the $n^{\rm th}$
derivative of $f$ at zero will be?
\item Plot (on the same coordinate axes) the third, fourth and fifth
derivatives of $f$.  What do you notice happens as you take more
and more derivatives?
\item Now we get to the big question:  Is $f$ representable
by its power series at $x=0$?  Why not?  HINT:  There is a formula
to estimate the remainder of Taylor's polynomial:
\begin{quote}
Given a function $f$ with $n$ continuous derivatives on the interval
$[a,b]$ and its $(n+1){\rm st}$ derivative defined on $(a,b)$, Taylor's
formula with remainder is:
$$
f(x)=\sum_{k=0}^n \frac{f^{(k)}(a)}{k!}(x-a)^k+
\frac{f^{(n+1)}(\beta_n)}{(n+1)!}(x-a)^{n+1}
$$
Where $\beta_n$ is some point in $(a,b)$.
\end{quote}
What is it about the derivatives of $f$ that tells us that its
associated Taylor polynomial will not converge to $f$ (except at
the trivial point, $x=0$)?
\end{enumerate}
\item Let's look at the multivariate version of Taylor's polynomial.
For visualization purposes, we'll only look at functions $z=f(x,y)$.

The Taylor polynomial for $z=f(x,y)$ at $(a,b)$ is given below.  The
function and all derivatives are evaluated at the point $(a,b)$:
$$
f+f_x(x-a)+f_y(y-b)+
$$
$$
\frac{1}{2}\left(
f_{xx}(x-a)^2+2f_{xy}(x-a)(y-b)+f_{yy}(y-b)^2
\right)+
$$
$$
\frac{1}{3!}\left(
f_{xxx}(x-a)^3+3f_{xxy}(x-a)^2(y-b)+3f_{xyy}(x-a)(y-b)^2+
f_{yyy}(y-b)^3
\right)+\ldots
$$
Note that the coefficients for the partials forms
Pascal's Triangle.
\begin{enumerate}
\item Why do you think there is a two in front of $f_{xy}$, and
$3$ in front of $f_{xxy}$ and $f_{xyy}$?  What would be the coefficients
in front of $f_{xxxy}, f_{xxyy}, f_{xyyy}$?
\item You can get Maple to compute the multivariate Taylor approximation
using {\tt mtaylor}.  Use Maple's {\tt help} feature to determine how
to use this command (in particular, try out the examples!).
\item Consider the ``peaks'' function, defined by:
$$
z=3(1-x)^2{\rm e}^{-x^2-(y+1)^2}
-10\left(\frac{1}{5}x-x^3-y^5\right){\rm e}^{-x^2-y^2}
-\frac{1}{3}{\rm e}^{-(x+1)^2-y^2}
$$
Graph the function and:
\begin{itemize}
\item At the origin, also plot higher and higher degree Taylor
approximations on the window: $-1\leq x \leq 1$, $-1\leq y \leq 1$.
\item At $(1,0)$, plot $z$ together with the 4th degree Taylor polynomial.
You choose the window size so that the Taylor approximation is ``good''.
\item At $(0,-2)$, plot $z$ together with the 4th degree Taylor polynomial.
You choose the window size so that the Taylor approximation is ``good''.
\end{itemize}
(NOTE:  To plot in 3-d, use {\tt plot3d}.  You'll need to recall
how to do multiple plots at once, or overlay plots using {\tt display3d}).
\end{enumerate}
\end{enumerate}

\end{document}
