CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.
CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.
Aaron Tresham Calculus Materials - Feb 2018 snapshot
licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Prerequisites:
Intro to Sage
Series
Taylor Series
Definition: A power series centered at is a series of the form
where and all the are constants.
Notice that a power series is a function of . The domain is all values of for which the series converges. There is always at least one number in the domain, namely .
You can think of a power series as a polynomial with (possibly) infinite degree.
One of the nice things about power series is that it's easy to differentiate and integrate them. Just like regular polynomials, you can take the derivative or integral of each term first, and then add up the results.
Example 1
A geometric series with as the common ratio is a simple example of a power series ( and for all ):
We know when this series converges and what it coverges to:
provided that .
So is a function with domain . On this domain, this power series function happens to be equal to the function .
Taylor Series
This raises the question of whether other functions are equal to the sum of a power series (at least for part of their domains).
In other words, given a function , can we find so that
for some interval of x-values?
This process of representing a function by a power series is called "expanding" the function into a series. The power series you get is called a Taylor series expansion of , after mathematician Brook Taylor (1685-1731).
Expanding functions into Taylor series and differentiating and integrating the series had a number of applications back then. For example, you can use Taylor Series to approximate the values of numbers like and . Or consider the logarithmic and trigonometric functions. These are often difficult to calculate, but if you expand these into Taylor series, then you can approximate values of these functions using only polynomials (and polynomials only require arithmetic to calculate).
Fortunately, finding the right power series to represent a function is fairly straightforward, as long as the function is repeatedly differentiable. The secret is to find derivatives of every order and evaluate them at .
Suppose , take the derivative, and plug in :
For all , , so when you plug in it's still 0.
For all , , with . So when you plug in , you get .
Finally, when , .
Putting this all together, we see that .
Therefore, .
Conclusion: If a function with derivatives of every order may be represented by a power series centered at on some interval , then that power series is
where the series converges on the interval .
Notice the "if" in the last sentence. There are functions that are not equal to the sum of their Taylor series, even if the series converges. We are not going to deal with such functions in this lab.
Example 2
Find the Taylor series of centered at (Taylor series centered at 0 are also called Maclaurin series).
We know in this case. Since , we have for all .
Thus, .
If equals the sum of its Taylor series, then . For this particular function, the Taylor series converges for all , and does equal the sum of the series (take my word for it).
Taylor Polynomials
The partial sums of a Taylor series are actual polynomials, called Taylor polynomials. In other words, the Taylor polynomial of degree is .
We can approximate a Taylor series to whatever level of accuracy we want by using a Taylor polynomial of high enough degree.
Note: If , then this polynomial will actually have degree less than .
Notice that the Taylor polynomial of degree 1 is .
Does this look familiar? It should! This is an equation for the tangent line to at . In other words, Taylor polynomials are generalizations of the tangent line to higher degree polynomials.
Also note that the Taylor polynomial of degree 2 is
This is the formula we used for Quadratic Approximation in Calc 1.
Example 3
We will use Taylor polynomials to approximate the value of . We saw above that .
The Taylor polynomial of degree is .
So . The approximation improves as increases.
If we plug in , we get .
Let's approximate the value of .
How big must be so that our approximation is correct for all the decimal places shown?
Let's look at some graphs.
is plotted in black, along with three Taylor polynomials (blue = degree 2, green = degree 3, red = degree 4)
Notice that the higher the degree the better the approximation.
Now try xmin=-10; xmax=10; ymax=1000
Notice that the Taylor polynomials are better approximations the closer you get to the center of the expansion (in this case ), just like the tangent line is a better approximation the closer you get to the point of tangency.
In the animation below, we see taylor polynomials of increasing degree (in blue) plotted with (in black).
We can use Sage to calculate Taylor polynomials using the "taylor" command. This command takes four arguments: the expression or function to expand, the variable of expansion, the center of the expansion, and the degree of polynomial you want.
Example 4
Use Sage to find the 10th-degree Taylor polynomial centered at for .
Example 5
Find the 15th-degree Taylor polynomials of centered at , , and .
Notice that some of the coefficients (the ) are 0 in this example.
Example 6
Find the Taylor polynomials of centered at of degrees 5, 10, and 15.
Example 7
Find the 10th-degree Taylor polynomial centered at of .
Here's a graph of this one for .