Next: Exercises Up: Taylor Series Previous: Mathematical Background

## Maple Commands for Taylor Series

Maple contains a built in function, taylor, for generating Taylor series. For example, the following maple command generates the first four terms of the Taylor series for the exponential function about x=0.5.

>taylor(exp(x),x=0.5,4);

Note the term at the end. This term represents the remainder function. The third argument of the taylor command corresponds to the order of the remainder term, not the degree of the Taylor polynomial printed out. Also, note that the presence of the remainder term prevents the output of the taylor command from being plotted or manipulated algebraically.

To overcome this obstacle, the CalcP package contains a slightly different command, Taylor (with a capital T). The output of the Taylor command is a polynomial that can be used in other expressions just like any other polynomial:

>with(CalcP):
>Taylor(exp(x),x=0.5,4);

>plot(",x=0..1);

Note that the third argument gives the degree of the Taylor polynomial output (unlike the first command, which gives the degree of the first term omitted).

For this lab, you will probably find the command Taylor to be more useful than the command taylor. We mention the first command because it is a standard Maple command.

A second useful command in the CalcP package is TayPlot. This command generates graphs of a function and several of its Taylor polynomials on the same plot.

>TayPlot(cos(x),x=0,{2,4,6},x=-Pi..Pi);

Prepared by P. Schultz