Taylor Series
Viewing Convergence
Notes to Student:
This lab is designed to help solidify the concepts we have discussed in class by "showing" you convergence and divergence. It also extends the fundamentals of series concepts to new areas of mathematical studies. Many of the examples are animated so you are encouraged to replay them often.
Time Allocation:
50 minutes
Introduction:
The necessity to approximate certain functions as sums of other functions has wide applications in engineering. This arises because sometimes we cannot perform certain computations easily on a given function and must resort to expressing that function in terms of more elementary functions. For example, suppose we wish to evaluate the integral shown below:
There is no elementary antiderivative for the integrand function but we can create an infinite power series representation for this integral and then integrate term-by-term to obtain a series solution for the antiderivative.
This lab is designed to help you visualize the convergence of Taylor Polynomials and a few applications of their usage.
Objectives Defined:
The goal of this lab is to establish a visual and conceptual understanding of the convergence/divergence of Taylor Polynomials. Although there are some significant notational elements scattered throughout the module, the focus is on the dynamics of convergence. We shall achieve this goal by:
1. Deriving several approximating Taylor/Maclaurin Polynomials.
2. Utilizing the power of animation to "see" the convergence of approximating polynomials.
3. Discussing "interval of convergence" and overall behavior.
4. Working through specific numerical examples.
5. Reviewing all concepts presented through Student Practice Problems.
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
" 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 polynomials 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):
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
>
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
" Click on the graph " and then use the sequential frame button again 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 polynomials. 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
>
" Click on the graph " and then use the sequential frame button again 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
" 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.
>
Using Taylor/Maclaurin Series to Approximate Integrals:
We can use a Taylor Series expansion to approximate the value of an integral. Consider the integral given by:
Suppose we wish to approximate this integral to within 0.001. We first find the Maclaurin (Taylor Series centered at a = 0) Series for
. If we examine the first 5 terms an obvious pattern emerges.
>
restart:with(plots):
for i from 1 to 5 do
print(convert(taylor(exp(x),x=0,i),polynom)):
end do:
r:=Sum('x^k/k!',k=0..infinity);
Warning, the name changecoords has been redefined
>
We conclude that:
If we substitute
we obtain the following integral:
We can now integrate term by term to obtain:
Since this is an alternating series, we can use the Alternating Series Estimation Theorem given below to determine the number of terms needed to satisfy our accuracy tolerance.
We want to find
n
such that
.
>
restart:with(plots):
for i from 0 to 6 do
a[i]:=1/((2.*i+1)*i!):
end do:
MATRIX([[n=0,n=1,n=2,n=3,n=4,n=5],[a[0],a[1],a[2],a[3],a[4],a[5]]]);
Warning, the name changecoords has been redefined
>
We can see that the tolerance is satisfied with n = 5. The approximate value of the integral is:
We can let MAPLE compute the integral internally. Run the code below by pressing "Enter".
> Int(exp(-x^2),x=0..1)=int(exp(-x^2),x=0..1.);
Notice that the difference between our estimate and the MAPLE estimate is within tolerance.
>
Using Taylor/Maclaurin Series to Determine Limits:
We can also substitute a series for a function in a limit problem. Consider the following limit:
If we substitute the Maclaurin series for both cosx and sinx we obtain:
You should verify this result by applying L'Hospital's Rule on the original problem.
>
Student Problem Set:
The following problems are for you to work out by hand and are representative of the examples discussed in this lab.
#1. Find a Maclaurin Series for cos x.
#2. Use the Maclaurin series for
and your answer in #1 to determine the following limit:
#3. Verify your result from #2 by L'Hospital's Rule.
#4. Derive the Maclaurin Series for xcos(2x).
#5. Approximate the following integral to within 0.001.
#6. If
f(
x) =
, show that
(0) =
.
Conclusions:
You have now completed the lab for Taylor Series. From this lab you should have seen the following:
1. It is often possible to represent a function by way of an infinite series.
2. Near a specified point we can tell the value of a function just by knowing the value of the function at the specified point and all its derivative's values at that point.
3. Some approximating polynomials are only convergent in certain intervals.
4. We can use a series to approximate the value of a difficult integral to a desired accuracy.
5. We can evaluate limits by substituting appropriate series representations.