next up previous
Next: About this document ... Up: No Title Previous: No Title

Subsections


Taylor Polynomials

Purpose

The purpose of this lab is to use Maple to introduce you to Taylor polynomial approximations to functions, including some applications.

Background

The idea of the Taylor polynomial approximation of order n at x=a, written Pn(x,a), to a smooth function f(x) is to require that f(x) and Pn(x,a) have the same value at x=a and, furthermore, that their derivatives at x=a must match up to order n. For example the Taylor polynomial of order three for $\sin(x)$ at x=0 would have to satisfy the conditions

\begin{displaymath}
\begin{array}
{ccccc}
P_3(0,0) & = & \sin(0) & = & 0\ P_3'(...
 ...n(0) & = & 0 \ P_3'''(0,0) & = & -\cos(0) & = & -1 \end{array}\end{displaymath}

You should check for yourself that the cubic polynomial satisfying these four conditions is

\begin{displaymath}
P_3(x,0) = x - \frac{1}{6} x^3.\end{displaymath}

The general form of the Taylor polynomial approximation of order n to f(x) is given by the following

Theorem 1

 Suppose that f(x) is a smooth function in some open interval containing x=a. Then the nth degree Taylor polynomial of the function f(x) at the point x=a is given by

\begin{displaymath}
P_n(x,a) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!} (x-a)^k \end{displaymath}

\begin{displaymath}
= f(a) + f'(a)(x-a) + \frac{f''(a)}{2}(x-a)^2 + \cdots 
 + \frac{f^{(n)}(a)}{n!} (x-a)^n\end{displaymath}

We will be seeing this formula a lot, so it would be good for you to memorize it now! The notation f(k)(a) is used in the definition to stand for the value of the k-th derivative of f at x=a. That is, f(1)(a) = f'(a), f(3)(a) = f'''(a), and so on. By convention, f(0)(a) = f(a). Note that a is fixed and so the derivatives f(k)(a) are just numbers. The following easier theorem should help you to see where the formula comes from.

Theorem 2

 Suppose f(x) is a smooth function in some open interval containing x=a and that k is a positive integer. Then gk(x) defined by

\begin{displaymath}
g_k(x) = \frac{f^{(k)}(a)}{k!} (x-a)^k \end{displaymath}

satisfies

gk(a) = 0

\begin{displaymath}
g_{k}^{(i)}(a) = 0 \mbox{ for $i=1 \ldots k-1$} \end{displaymath}

gk(k)(a) = f(k)(a)

Accuracy and Tolerance

To measure how well a Taylor Polynomial approximates the function over a specified interval [c,d], we define the tolerance Tol of Pn(x,a) to be the maximum of the absolute error

\begin{displaymath}
\mid f(x)- P_n(x,a) \mid \end{displaymath}

over the interval [c,d]. The Getting started worksheet has examples of how to compute and plot the absolute error.

Exercises

1.
For the following functions and base points, determine what order is required so that the Taylor polynomial approximates the function to within a tolerance of 0.5 over the given interval. Include explanations how you got your answers in your report.
(a)
$f(x) = \exp(-x)$, base point x=0, interval [-2,2].
(b)
$f(x) = \sin(x)$, base point x=0, interval $[0,6\pi ]$.
(c)
$f(x) = \ln(1+x)$, base point x=0, interval [-0.9,0.9].
(d)
f(x) = 1/x, base point x=1, interval [0.5, 1.5].
2.
Prove Theorem 2. Remember that an example is not a proof! (Note - this should be done by hand. part of using Maple is knowing when not to use it.)

3.
For the third function in exercise 1, $\ln(x+1)$, consider the Taylor polynomial with base point x=0. Can you choose the order so that the Taylor polynomial is a good approximation (within 0.1, say) to $\ln(x+1)$ at x=2? How about at x=0.5? Discuss the difference in the behavior of the Taylor polynomials at these two points. Can you divide the real line up into two parts, one where the approximation is good and one where it is bad?

4.
You know that the derivative of $\sin(x)$ is $\cos(x)$. Can you find a relationship between the derivative of the $n\mbox{th}$ order Taylor polynomial with base point x=0 for $\sin(x)$ and and a Taylor polynomial of some order with base point x=0 for $\cos(x)$?

5.
You know that the indefinite integral of $\sin(x)$ is $-\cos(x)$. Can you find a relationship between the indefinite integral of the $n\mbox{th}$ order Taylor polynomial with base point x=0 for $\sin(x)$ and and a Taylor polynomial of some order with base point x=0 for $-\cos(x)$? (Hint - your answer should be yes.)

6.
One of the applications of Taylor polynomials is in approximating integrals. In the last lab, we encountered the error function $\mathrm{erf}(x)$, which is defined by

\begin{displaymath}
\mbox{erf}(x) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} \exp(-t^2) \, dt\end{displaymath}

The idea of using Taylor polynomials to approximate the integral is to replace the $\exp(-t^2)$ with its Taylor polynomial, which can be easily integrated. Can you find the minimum order required to approximate $\mbox{erf}(2)$ to within an accuracy of 0.05? Use zero for the base point of the Taylor polynomials.


next up previous
Next: About this document ... Up: No Title Previous: No Title

William W. Farr
11/9/1998