Taylor Series

Manipulate[
LocatorPane[Dynamic[{xx,func/.x->xx},(xx=First[#])&],

Dynamic@Switch[view,

"graphs",

Dynamic[Plot[Evaluate[{func/.x->t,Normal[Series[func/.x->t,{t,xx,ApproxOrder}]]}],{t,-2 Pi,2 Pi},ImageSize->{450,400},AspectRatio->Automatic,PlotRange->{{-2 Pi,2 Pi},{-4,4}},Axes->True]],

"difference",

Deploy[Dynamic[Graphics[{First[Plot[Evaluate[Abs[func-Normal[Series[func,{x,xx,IntegerPart[ApproxOrder]}]]]],{x,-2π,2π}]],Arrow[{{xx,0}+{0,1},{xx,0}}]},ImageSize->{450,400},PlotRange->{{-2π,2π},{-1,7}},Axes->True, AspectRatio -> Automatic,ImagePadding->{{20,20},{10,10}}]]]
]
,Appearance->Switch[view,"graphs",Automatic,"difference",None]],



{{xx,0},-2,2,ControlType->None},{{func,Sin[x]+Cos[x],"function"},{Sin[x]->TraditionalForm[Sin[x]],Tan[x]->TraditionalForm[Tan[x]],Cos[x]->TraditionalForm[Cos[x]],Sin[x]+Cos[x]->TraditionalForm[Sin[x]+Cos[x]],Sec[x]->TraditionalForm[Sec[x]]}},{{ApproxOrder,3,"approximation order"},0,11,1,Appearance->"Labeled"},{{view,"graphs","view"},{"graphs","difference"}}]

CAPTION

A Taylor series approximates the chosen function. Move the locator to change the center of the approximation. Change the view to see the accuracy.

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Taylor Series" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/TaylorSeries/

Contributed by: Michael Ford

Suggested by: Math Everywhere, Inc.

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »