Defining Taylor/Maclaurin Series and their nth-Polynomials:(Animated)
In class we developed the basic power series expansion about the point, a, as:
This series is called the Taylor Series of the function f about (or centered at) "a". If a = 0, then we get the special case which is called a Maclaurin Series. It looks as follow:
Note: If the function f can be represented by a power series about "a" then the above equalities hold true.
Now, we can use partial sums to approximate f(x). These partial sums are called Taylor Polynomials of degree n. Let's look at a few for f(x) =
. We will expand this function about a = 0. The code below will compute the first 4 Taylor polynomials.Place the cursor in the red restart command and press "Enter".
| > | restart:with(plots):
for i from 1 to 4 do a[i]:=convert(taylor(exp(x),x=0,i),polynom): end do: MATRIX([[T0,T1,T2,T3],[a[1],a[2],a[3],a[4]]]); |
Warning, the name changecoords has been redefined
The approximating Taylor Polynomials are shown above.
To see how well these functions approximate f(x) =
near the expansion point "a = 0", we shall superimpose them onto the same graph. It is best to run individual frame changes as opposed to streaming frame changes using the Animation Toolbar which appears at the top when you click on the picture. Press "Enter" to begin.
| > | restart: with(plots):
f:=x->exp(x): c:=0: n:=4: T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end: Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-2..1,y=-.1..3,thickness=3,title="Taylor Polynomial Convergence\nf(x) = exp(x)\n a = 0",color=magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true): p:=display(seq(textplot([-0.9,2,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta),i=1..n),insequence=true): Function:=plot(f(x),x=-2..1,y=-.1..3,color=blue,thickness=3): display(Graph,Function,p); |
Warning, the name changecoords has been redefined
![[Plot]](images/TaylorWeb_4.gif)
"Click on the graph" and then use the sequential frame button ( ->| ) to see how the Taylor Polynomials "fit" the exponential graph near x = 0. Pay attention as to how accurate the approximating polynoimials are as they increase in degree.
Example of sinx about a = 0.
The next example shows the first 6 Taylor Polynomials for f(x) = sinx expanded about a = 0.
| > | restart: with(plots):
f:=x->sin(x): c:=0: n:=6: T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end: Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-6..5,y=-3..5,thickness=3,title="Taylor Polynomial Convergence\nf(x) = sin(x)\n a = 0",color = magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true): p:=display(seq(textplot([-3,3,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta),i=1..n),insequence=true): Function:=plot(f(x),x=-6..5,y=-3..5,color=blue,thickness=3): display(Graph,Function,p); |
Warning, the name changecoords has been redefined
![[Plot]](images/TaylorWeb_5.gif)
"Click on the graph" and then use the sequential frame button agian to see how the Taylor Polynomials "fit". Notice how the even numbered approximating polynomials are equivalent to the odd numbered. Also, as we increase the degree of the Taylor Polynomial the interval of convergence "expands".
Example of lnx about a = 2.
Our next example creates the first 4 Taylor Polynomials for f(x) = ln(x) centered at " a = 2". Press "Enter" to see the first 4 Taylor Polynomials.
| > | restart:with(plots):
for i from 1 to 4 do a[i]:=convert(taylor(ln(x),x=2,i),polynom): end do: MATRIX([[T0,T1,T2,T3],[a[1],a[2],a[3],a[4]]]); |
Notice the ascending powers in the approximating polynolmials. Press "Enter" to continue.
Warning, the name changecoords has been redefined
| > | restart: with(plots):
f:=x->ln(x): c:=2: n:=4: T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end: Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-5.5..5,y=-8..5,thickness=3,title="Taylor Polynomial Convergence\nf(x) = ln(x)\na = 2",color = magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true): p:=display(seq(textplot([-1,5,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta),i=1..n),insequence=true): Function:=plot(f(x),x=-5..5,y=-8..5,color=blue,thickness=3): display(Graph,Function,p); |
Warning, the name changecoords has been redefined
![[Plot]](images/TaylorWeb_7.gif)
| > |
"Click on the graph" and then use the sequential frame button agian to see how the Taylor Polynomials approximate the given function near the expansion point. Notice the restricted domain for our chosen function.
Example with limited interval of convergence centered at a = 0.
Our final example shows that many Taylor Series Polynomials only "converge well" over a certain interval. Both in class and in your book we discussed "interval of convergence". Consider the function:
we can create the Taylor Polynomial expansion for, say, the first 9 terms. Press "Enter" to continue.
| > | restart: with(plots):
f:=x->1/(1-x): c:=0: n:=9: T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end: Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-5..1,y=-5..4,thickness=3,title="Taylor Polynomial Convergence\nf(x) = 1/(1-x)\na = 0",color = magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true): p:=display(seq(textplot([-1.4,6,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta,view=[-5..1,-5..6]),i=1..n),insequence=true): Function:=plot(f(x),x=-5..1,y=-5..4,color=blue,thickness=3,discont=true): display(Graph,Function,p); |
Warning, the name changecoords has been redefined
![[Plot]](images/TaylorWeb_9.gif)
"Click on the graph" and use the sequential frame button to see how the Taylor Polynomials approximate the given function near the expansion point. Notice that the approximating polynomials do not extend for values less than negative 1. Replay the animation to verify this.
| > |