8.7 Taylor Polynomials and Series

Mathematica script by Chris Parrish,
cparrish@sewanee.edu

Sources and references for some of these problems include
James Stewart, "Calculus: Concepts and Contexts," Second Edition, Brooks/Cole, 2001
Deborah Hughes-Hallett, Andrew M. Gleason, et. al., "Calculus," Second Edition, John Wiley & Sons, 1998
Robert Fraga, ed., "Calculus Problems for a New Century," The Mathematical Association of America, 1993

Mathematica manipulations from
Skeel and Keiper, pages 171-182

Taylor Polynomials

Taylor polynomials in Mathematica

In[68]:=

Series[Sqrt[1+h],{h,0,4}]

Out[68]=

In[69]:=

s = Series[Cos[h],{h,0,5}]

Out[69]=

The supporting data structure:

In[70]:=

?SeriesData
FullForm[s]

Out[71]//FullForm=

An operation applied to a series results in a series.

In[72]:=

ls = Log[s]

Out[72]=

Normal will truncate a series.

In[73]:=

diff = Normal[ls] - Log[Cos[h]]

Out[73]=

In[74]:=

Plot[diff,{h,-0.2,0.2},
PlotRange->All,
PlotStyle->Indigo];

Polynomials

CoefficientList

In[75]:=

Out[75]=

In[76]:=

CoefficientList[p,x]

Out[76]=

In[77]:=

CoefficientList[p,y]

Out[77]=

To go the other way, ...

In[78]:=

{a,b,c,d} . (x^Range[0,3])

Out[78]=

Examples

Taylor Polynomials

In[79]:=

ln[x_] = Normal[Series[Log[x],{x,1,3}]]

Out[79]=

In[80]:=

Plot[{Log[x],ln[x]},{x,0.1,4},
PlotLabel -> "Taylor Polynomial Approximation",
PlotStyle -> {{Thickness[0.002],Red},
{Thickness[0.004],Green}}];

Problems from Hughes-Hallett, Gleason, et al.

Taylor polynomial for Cos[x] near x = 0

Hughes-Hallett, Gleason, et al, First Edition, Exercise 10.1.1, page 598

In[81]:=

Clear[f,taylor,x,x0,a,b,n]

x0 = 0;
n = 4;

f[x_] := Cos[x]

taylor[x_] = Normal[Series[f[x],{x,x0,n}]]

Out[85]=

In[86]:=

a = -4;
b = 4;

Plot[{f[x],taylor[x]},{x,a,b},
PlotLabel -> "Taylor Polynomial Approximation",
PlotStyle -> {{Thickness[0.002],Red},
{Thickness[0.004],Green}}];

Taylor polynomial for near x=0

Hughes-Hallett, Gleason, et al, First Edition, Exercise 10.1.8, page 598

In[89]:=

Out[93]=

In[94]:=

a = 0.0;
b = 0.999;

Plot[{f[x],taylor[x]},{x,a,b},
PlotLabel -> "Taylor Polynomial Approximation",
PlotStyle -> {{Thickness[0.002],Red},
{Thickness[0.004],Green}}];

Taylor polynomial for Cos[x] near x = π/2

Hughes-Hallett, Gleason, et al, First Edition, Exercise 10.1.13, page 598

In[97]:=

Out[101]=

In[102]:=

a = -4;
b = 4;

Plot[{f[x],taylor[x]},{x,a,b},
PlotLabel -> "Taylor Polynomial Approximation",
PlotStyle -> {{Thickness[0.002],Red},
{Thickness[0.004],Green}}];

Taylor polynomial for Exp[] near x=0

Hughes-Hallett, Gleason, et al, First Edition, Exercise 10.1.34, page 598

In[105]:=

Out[109]=

In[110]:=

a = -2;
b = 2;

Plot[{f[x],taylor[x]},{x,a,b},
PlotLabel -> "Taylor Polynomial Approximation",
PlotStyle -> {{Thickness[0.002],Red},
{Thickness[0.004],Green}}];

In[113]:=

Clear[g,taylor,x,x0,a,b,n]

x0 = 0;
n = 3;

g[x_] := Exp[x]

taylor[x_] = Normal[Series[g[x],{x,x0,n}]]

Out[117]=

In[118]:=

Out[118]=

Conclusion:   taylor[Exp[]] == taylor[Exp[x]] evaluated at

Created by Mathematica  (May 5, 2004)