Taylor Polynomials Taylor Polynomials about NiMvJSJ4RyIiIQ==. A primary use of Taylor polynomials is to find good polynomial approximations to a function near a specified value. As a first example, we use a fourth degree Taylor polynomial to approximate NiMvLSUiZkc2IyUieEctJSRleHBHRiY= near NiMvJSJ4RyIiIQ==. We begin by entering our function as a Maple expression. restart;with(plots); f:=exp(x); We first use the comand taylor to form the Taylor series, which we will discuss later, for the function. The first parameter is the function expression, the second, assuming NiMlInhH is our variable, is "NiMlInhH =" the number we want to approximate near, and the third is an integer one higher than the degree of the Taylor polynomial we desire. We desire degree 4 here, so use 5. T4:=taylor(f,x=0,5); This is the Taylor polynomial of degree 4 with a remainder term NiMtJSJPRzYjKiQpJSJ4RyIiJiIiIg==. This remainder term is pronounced as "big Oh of NiMqJCklInhHIiImIiIi." To get the Taylor polynomial as an expression from the Taylor series, we must convert the series NiMlI1Q0Rw== to a polynomial using convert. P4:=convert(T4,polynom); Now let's plot both the function (red) with the Taylor polynomial (blue). plot0:=plot(f,x=-2..3,color=red): plot1:=plot(P4,x=-2..3,color=blue): display(plot0,plot1); We see that the graphs are basically the same for NiMlInhH between -1 and 1, but start to differ to the left and right of this interval. Let's check a couple of values for NiMlInhH. We work out from 0, checking the difference at .5, 1, and 1.5. evalf(subs(x=.5,f-P4)); evalf(subs(x=1,f-P4)); evalf(subs(x=1.5,f-P4)); Note that the approximations are quite good near 0, but lose accuracy as one moves away from 0. We see the same effect as we move to the left. evalf(subs(x=-.5,f-P4)); evalf(subs(x=-1,f-P4)); evalf(subs(x=-1.5,f-P4)); Now let's look at a larger window. plot0:=plot(f,x=-10..10,color=red): plot1:=plot(P4,x=-10..10,color=blue): display(plot0,plot1); We now see considerable difference between the two graphs away from 0, In fact they differ by more than 20,000 at NiMvJSJ4RyIjNQ==. Suppose NiMlImZH has n derivatives at 0. Then the Taylor polynomial of degree NiMlIm5H about NiMvJSJ4RyIiIQ== for NiMlImZH is NiMmJSJQRzYjJSJuRw==(NiMlInhH) = NiMtJSRzdW1HNiQqJiIiIkYnLSUqZmFjdG9yaWFsRzYjJSJrRyEiIi9GKzsiIiElIm5H NiMpJSJmRyUia0c=(NiMiIiE=) NiMpJSJ4RyUia0c=. This polynomial has the same value as the function at 0, and it's first NiMlIm5H derivatives have the same value at 0 as do the corresponding derivatives of the function. Let's examine Taylor polynomials further by using the function NiMvLSUiZkc2IyUieEctJSNsbkc2IywmRiciIiJGLEYs. f:=ln(x+1); For this (and any) function, the Taylor polynomial of degree 0 is the constant polynomial that has the same value as NiMlImZH at 0. T0:=taylor(f,x = 0,1); p0 := convert(T0,polynom); We plot the function (in red) along with the Taylor polynomial (in blue). plot0:=plot(f,x=-1..4,color=red): plot1:=plot(p0,x=-1..4,color=blue,thickness=3): display(plot0,plot1); Note that the approximation is not very good except very near NiMvJSJ4RyIiIg==. Let's see what happens as we move up a degree to a first order Taylor polynomial. T1:=taylor(f,x = 0,2); p1 := convert(T1,polynom); This is also the linear approximation to NiMlImZH at NiMvJSJ4RyIiIQ==. In the plot below, we see that this linear approximation, which also has the same derivative as NiMlImZH at NiMvJSJ4RyIiIQ==, is better than the constant approximation. plot0:=plot(f,x=-1..4,color=red): plot1:=plot(p1,x=-1..4,color=blue): display(plot0,plot1); When we advance to the second degree Taylor Polynomial, where the function and the polynomial have the same second derivative at 0, our quadratic approximation gets even better since the polynomial has the same concavity as the function near 0. T2:= taylor(f,x = 0,3); p2:=simplify(convert(T2,polynom)); plot0:=plot(f,x=-1..4,color=red): plot1:=plot(p2,x=-1..4,color=blue): display(plot0,plot1); Notice that we have very good agreement from -.2 to .6. Let's go the the third degree Taylor polynomial. T3:= taylor(f,x = 0,4); p3:=simplify(convert(T3,polynom)); plot0:=plot(f,x=-1..4,color=red): plot1:=plot(p3,x=-1..4,color=blue): display(plot0,plot1); Now we have good agreement from -.6 to .8. We check degree 4. T4:= taylor(f,x = 0,5); p4:=simplify(convert(T4,polynom)); plot0:=plot(f,x=-1..4,y=-4..4,color=red): plot1:=plot(p4,x=-1..4,y=-4..4,color=blue): display(plot0,plot1); This looks good from -.7 to .9. For the fifth degree: T5:= taylor(f,x = 0,6); p5:=simplify(convert(T5,polynom)); plot0:=plot(f,x=-1..4,y=-4..4,color=red): plot1:=plot(p5,x=-1..4,y=-4..4,color=blue): display(plot0,plot1); Now we get good approximations from -.7 to 1. For degree six: T6:= taylor(f,x = 0,7); p6:=simplify(convert(T6,polynom)); plot0:=plot(f,x=-1..4,y=-4..4,color=red): plot1:=plot(p6,x=-1..4,y=-4..4,color=blue): display(plot0,plot1); This looks good from -.8 to .9. Now let's jump to degree 200: T200:= taylor(f,x = 0,201): p200:=simplify(convert(T200,polynom)): plot0:=plot(f,x=-1..4,y=-4..4,color=red): plot1:=plot(p200,x=-1..4,y=-4..4,color=blue): display(plot0,plot1); With the following spreadsheet, we get a second view how well various Taylor polynomials approximate our function near 0. for i from 1 to 3 do T[10^i]:= taylor(f,x = 0,10^i+1): p[10^i]:=simplify(convert(T[10^i],polynom)): od: NiMlInhH NiMtJSNsbkc2IywmJSJ4RyIiIkYoRig= NiMtJiUiUEc2IyIiJTYjJSJ4Rw== NiMtJiUiUEc2IyIjNTYjJSJ4Rw== NiMtJiUiUEc2IyIkKyI2IyUieEc= NiMtJiUiUEc2IyIlKzU2IyUieEc= NiMkISImISIi NiMkISsxPVpKcCEjNQ== NiMkIStubSJII28hIzU= NiMkIStpJlsxJHAhIzU= NiMkISszPVpKcCEjNQ== NiMkISszPVpKcCEjNQ== NiMkISIlISIi NiMkIStRaUQzXiEjNQ== NiMkIStMTEx4XSEjNQ== NiMkISsrZj4zXiEjNQ== NiMkIStOaUQzXiEjNQ== NiMkIStOaUQzXiEjNQ== NiMkISIkISIi NiMkIStSJVxuYyQhIzU= NiMkISsrK0RnTiEjNQ== NiMkISs8c3VtTiEjNQ== NiMkIStUJVxuYyQhIzU= NiMkIStUJVxuYyQhIzU= NiMkISIjISIi NiMkISs4YlZKQSEjNQ== NiMkIStubW1JQSEjNQ== NiMkISsiXE45QiMhIzU= NiMkISs5YlZKQSEjNQ== NiMkISs5YlZKQSEjNQ== NiMkISIiRiQ= NiMkIStkXmdgNSEjNQ== NiMkIStMTGVgNSEjNQ== NiMkIStkXmdgNSEjNQ== NiMkIStjXmdgNSEjNQ== NiMkIStjXmdgNSEjNQ== NiMkIiIiISIi NiMkIishKXosSiYqISM2 NiMkIitMTCQzYCohIzY= NiMkIishKXosSiYqISM2 NiMkIiskKXosSiYqISM2 NiMkIiskKXosSiYqISM2 NiMkIiIjISIi NiMkIitvYkBCPSEjNQ== NiMkIitubW1BPSEjNQ== NiMkIitgYkBCPSEjNQ== NiMkIitxYkBCPSEjNQ== NiMkIitxYkBCPSEjNQ== NiMkIiIkISIi NiMkIitYRWtCRSEjNQ== NiMkIisrK3Y+RSEjNQ== NiMkIisiUVRPaSMhIzU= NiMkIitYRWtCRSEjNQ== NiMkIitYRWtCRSEjNQ== NiMkIiIlISIi NiMkIittQnNrTCEjNQ== NiMkIitMTExcTCEjNQ== NiMkIitdV3BrTCEjNQ== NiMkIitsQnNrTCEjNQ== NiMkIitsQnNrTCEjNQ== NiMkIiImISIi NiMkIisiM15ZMCUhIzU= NiMkIitubVQ1UyEjNQ== NiMkIit5a01hUyEjNQ== NiMkIishM15ZMCUhIzU= NiMkIishM15ZMCUhIzU= NiMkIiInISIi NiMkIisjSE8rcSUhIzU= NiMkIisrKysnZiUhIzU= NiMkIit6ayF6cCUhIzU= NiMkIismSE8rcSUhIzU= NiMkIismSE8rcSUhIzU= NiMkIiIoISIi NiMkIis2REcxYCEjNQ== NiMkIitMTDMkNCYhIzU= NiMkIitxL0smSCYhIzU= NiMkIis1REcxYCEjNQ== NiMkIis1REcxYCEjNQ== NiMkIiIpISIi NiMkIitcbSd5KGUhIzU= NiMkIitubW0jWyYhIzU= NiMkIitxWHZLZSEjNQ== NiMkIitZbSd5KGUhIzU= NiMkIitZbSd5KGUhIzU= NiMkIiIqISIi NiMkIitpKVEmPWshIzU= NiMkIisrK3ZSZCEjNQ== NiMkIitXNSk+RSchIzU= NiMkIis3d2A9ayEjNQ== NiMkIitqKVEmPWshIzU= NiMiIiI= NiMkIisxPVpKcCEjNQ== NiMkIitMTExMZSEjNQ== NiMkIisxI1xqWCchIzU= NiMkIiskekA8KW8hIzU= NiMkIisxVlpFcCEjNQ== Taylor Polynomials about NiMvJSJ4RyUiYUc=. Now we look at the Taylor polynomial of degree NiMlIm5H about NiMvJSJ4RyUiYUc= for a function NiMlImZH . This is given by NiMmJSJQRzYjJSJuRw==(NiMlInhH) = NiMtJSRzdW1HNiQqJiIiIkYnLSUqZmFjdG9yaWFsRzYjJSJrRyEiIi9GKzsiIiElIm5H NiMpJSJmRyUia0c=(NiMlImFH) NiMpLCYlInhHIiIiJSJhRyEiIiUia0c=. This polynomial has the same value as the function at NiMlImFH, and it's first NiMlIm5H derivatives have the same value at NiMlImFH as do the corresponding derivatives of the function. Let's examine these Taylor polynomials further by using the function NiMvLSUiZkc2IyUieEctJSRzaW5HRiY= about NiMvJSJ4RyomJSNQaUciIiIiIichIiI=. restart:with(plots): f:=sin(x); We begin with degree 0. T0:=taylor(f,x = Pi/6,1); p0 := convert(T0,polynom); We plot the function (in red) along with the Taylor polynomial (in blue). plot0:=plot(f,x=-2*Pi..2*Pi,color=red): plot1:=plot(p0,x=-2*Pi..2*Pi,color=blue): display(plot0,plot1); Degree 1 or linear approximation. Notice the use of collect to get a polynomial in NiMlInhH. T1:=taylor(f,x = Pi/6,2); p1 := collect(convert(T1,polynom),x); plot0:=plot(f,x=-2*Pi..2*Pi,color=red): plot1:=plot(p1,x=-2*Pi..2*Pi,color=blue): display(plot0,plot1); Second degree. T2:= taylor(f,x = Pi/6,3); p2:=collect(convert(T2,polynom),x); plot0:=plot(f,x=-2*Pi..2*Pi,y=-5..5,color=red): plot1:=plot(p2,x=-2*Pi..2*Pi,y=-5..5,color=blue): display(plot0,plot1); Degree 3. T3:= taylor(f,x = Pi/6,4); p3:=collect(convert(T3,polynom),x); plot0:=plot(f,x=-2*Pi..2*Pi,y=-5..5,color=red): plot1:=plot(p3,x=-2*Pi..2*Pi,y=-5..5,color=blue): display(plot0,plot1); Degree 4. T4:= taylor(f,x = Pi/6,5); p4:=collect(convert(T4,polynom),x); plot0:=plot(f,x=-2*Pi..2*Pi,y=-5..5,color=red): plot1:=plot(p4,x=-2*Pi..2*Pi,y=-5..5,color=blue): display(plot0,plot1); Degree 5: T5:= taylor(f,x = Pi/6,6); p5:=collect(convert(T5,polynom),x); plot0:=plot(f,x=-2*Pi..2*Pi,y=-5..5,color=red): plot1:=plot(p5,x=-2*Pi..2*Pi,y=-5..5,color=blue): display(plot0,plot1); Degree 6. T6:= taylor(f,x = Pi/3,7); p6:=collect(convert(T6,polynom),x); plot0:=plot(f,x=-2*Pi..2*Pi,y=-5..5,color=red): plot1:=plot(p6,x=-2*Pi..2*Pi,y=-5..5,color=blue): display(plot0,plot1); Degree 25. T25:= taylor(f,x = Pi/6,26): p25:=collect(convert(T25,polynom),x): plot0:=plot(f,x=-4*Pi..4*Pi,y=-5..5,color=red): plot1:=plot(p25,x=-4*Pi..4*Pi,y=-5..5,color=blue): display(plot0,plot1);