Taylor Polynomials--A Visual Approach to Approximations


Approximations to f(x) = cos(x).

 

Objective:  The purpose of this demo is to use a graph of the function y = f(x) and its nth Taylor Polynomial, pn(x) to illustrate the approximation of y = f(x) by a Taylor Polynomial centered at x = a. We include an option for the visualization of the error function  Rn(x) = f(x) - pn(x).

Level:  This demo is appropriate for any course in which Taylor Polynomials are discussed.  

Prerequisites: Students should be familiar with computing derivatives of a function at x = a and with the definition of nth Taylor Polynomial centered at x = a.

Platforms:  
(1) Browser Based:  
      (a) A Javascript slide show for several example functions.  The
           Javascript codes have been tested using Internet Explorer 5+ and 
           Netscape 4.5+.
        (b) Animated gifs (for browsers that are not Javascript enabled.)
(2)  Mathematica Notebook
(3)  MATLAB M-files
(4)  Maple 6
(6)  Mathcad
(7)  TI-89
(8)  Derive

Instructor's Notes:  An important area in mathematics is the computation of approximate values for functions at particular points.  One of the first encounters students have with such approximations is using the slope of a secant line to a graph to estimate the slope of a tangent line.  Then the equation of a tangent line at a point is used for a linear approximation to the function in a neighborhood of the point.  As they study Taylor Polynomials the more general problem of approximating a function by a polynomial is encountered.

Suppose we are interested in approximating a function y = f(x) near x = a by a polynomial of degree n:

.

The strategy we use to find the coefficients is to require a high degree of "match" at x = a.  Specifically, if we require that the polynomial and its first n derivatives at x = a match the function and its first n derivatives at x = a, the result of these requirements is that we construct a formula for the nth Taylor Polynomial for f, centered at x = a:

.

When a = 0, the polynomial is called an nth Maclaurin polynomial for f.

Students spend so much time learning this rather complicated formula, they tend to lose sight of why they would want to use a polynomial to approximate a function. They also never seem to really grasp exactly what it is they have found or how good the approximation might be. 

Once I have introduced Taylor Polynomials in class, I show this demonstration to students. We calculate the terms of the Taylor Polynomial in class, and use a Javascript slide show to get a picture of what we are calculating. Click on the following links to view slide shows for the following functions and their approximation by Maclaurin and/or Taylor Polynomials.

Example 1:

(a) Slide Show
(b) Animated gif

Example 2:  
(a)  Slide Show
(b)  Animated gif

Example 3:  

(a) Slide Show
(b) Animated gif

Example 4:   
(a) Slide Show
(b) Animated gif

Example 5:   
(a) Slide Show
(b) Animated gif

Example 6:  

(a)  Slide Show
(b)  Animated gif


Example 7: 
(a)  Slide Show
(b)  Animated gif

Other issues involved in approximation are "How GOOD is the approximation?" and "Over what interval can I expect the approximation to be good?"

To investigate these issues, the Javascript slide shows have an option to display the error associated with the nth Taylor polynomial.  The error at any value for x is defined to be

Rn(x) = f(x) - pn(x).  

Rn(x) is sometimes called the nth remainder of f.

By plotting the error function, we can visualize the "goodness" of the approximation for various values of n as well as the interval over which the approximation could be considered "good."  These ideas lead to a discussion of the interval of convergence for a Taylor series.  In Examples 1-6 above, it is not hard to convince students that the interval of convergence is , while in Example 7 the interval of convergence is (-1,1).  More details about error analysis may be appropriate in a numerical analysis class, however, the pictures supply a visual foundation and hence an intuitive idea about what we mean when we say that the Taylor Series converges to f(x) (in an appropriate interval) if and only if the nth remainder tends to 0 as n increases without bound.


Approximation to f(x) = cos(x) by Maclaurin Polynomials and the error.

 

 


Approximation to f(x) = log(x+1) by Maclaurin Polynomials and the error.

My experience has been that this demo plants a visual image of the idea of Taylor approximation that students readily recall.  As a result they seem to remember that the nth Taylor Polynomial at x = a agrees with the function and its first n derivatives at x = a. I surveyed my Calculus 3 students before we began a discussion of Taylor Series. The students who had seen the demo in the previous year all remembered much more clearly and could put into words what a Taylor Polynomial is used for, and why we might want to use one.


Additional Resources:

Taylor Polynomial Web Site by Cathy Frey.  Click here to download Cathy Frey's Mathematica file.

Mathematica Notebook: Preview and download an interactive Mathematica notebook here.  

MATLAB M-Files: Two MATLAB M-files, sinmovie.m and logmovie.m, illustrate the approximation of f(x) = sin(x) and f(x) = log(x),respectively, by Taylor Polynomials.  These files were developed by David R. Hill.  Preview the animations and download from here.

Maple 6 Worksheet: Preview and download an interactive Maple 6 worksheet from here.

Mathcad Worksheet: Preview and download an interactive Mathcad worksheet from here.

TI-89 Calculator Program:  TI-89 animation of Taylor Polynomial approximations. View and download from here.  The TI-89 program was developed by Lila F. Roberts.

Gallery of Animations for Examples 1- 7.


Credits:  This demo was submitted by 

Cathy Frey
Associate Professor of Mathematics
Norwich University
158 Harmon Drive
Northfield, VT 05663

and is included in Demos with Positive Impact with her permission.


 

LFR 7/7/01   Last updated 5/24/2006  DRH
Hit count prior to 2/1/2005 was lost.

Visitors since 2/1/2005