next up previous
Next: About this document ... Up: lab_template Previous: lab_template


Taylor Polynomials


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

Getting Started

To assist you, there is a worksheet associated with this lab that contains examples and even solutions to some of the exercises. You can copy that worksheet to your home directory with the following command, which must be run in a terminal window, not in Maple.

cp ~bfarr/Taylor_start.mws ~

You can copy the worksheet now, but you should read through the lab before you load it into Maple. Once you have read to the exercises, start up Maple, load the worksheet Taylor_start.mws, and go through it carefully. Then you can start working on the exercises.


The idea of the Taylor polynomial approximation of order $n$ at $x=a$, written $P_n(x,a)$, to a smooth function $f(x)$ is to require that $f(x)$ and $P_n(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

P_3(0,0) & = & \sin(0) & = & 0\\
...0) & = & 0 \\
P_3'''(0,0) & = & -\cos(0) & = & -1

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 $n$th 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. That is, a Taylor polynomial has the form

\begin{displaymath}\sum_{k=0}^{n} a_k (x-a)^k \end{displaymath}

which you should recognize as a power series that has been truncated.

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 $P_n(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.


  1. For the following functions and base points, determine what minimum order is required so that the Taylor polynomial approximates the function to within a tolerance of $0.2$ over the given interval.
    1. $f(x) = \exp(x)$, base point $x=0$, interval $[-2,2]$.
    2. $f(x) = \cos(2x)$, base point $x=0$, interval $[0,2\pi ]$.
    3. $f(x) = 1/x^2$, base point $x=2$, interval $[0.5, 3.5]$.

  2. For the function, $f(x) = -x/(2-x)$, use the TayPlot command to plot the function and a Taylor polynomial approximation of order 5 with base point $x=0$ on the same graph over the interval $-3 \leq x \leq 0$. If you increase the order of the Taylor polynomial, can you get a good approximation at $x=-2$? Can you explain this in terms of what you know about the convergence of power series?

  3. 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.)

next up previous
Next: About this document ... Up: lab_template Previous: lab_template
William W. Farr