Math 1205Worksheet 8: Taylor Polynomials
Introduction:
Basic Idea: (Refer to the text, p. 266)
Let be a function defined on some domain containing the point . Suppose we want to use a polynomial of a certain fixed degree to approximate the function as well as we can in some neighborhood of the point of interest . To make the discussion specific, let's assume that we have a polynomial of degree 3. We can write a general polynomial of degree 3 as
where are arbitrary constants. (It is more convenient to express the polynomial in powers of rather than in powers of .) How do we specify these constants to "best" approximate our function in the vicinity of the point ? Implicit in this question is the additional question, "What do we mean by 'best'?" We'll answer both questions in the following way.
We would certainly want the polynomial and the function to have the same value at . Setting leads to
.
This determines the first coefficient. Next, it seems reasonable to require that the polynomial and function have the same slope at . Since , setting leads to
.
Continuing along in this manner, we next require that the polynomial and function have the same second derivative at . Since , setting leads to
,
or . By now, the pattern is hopefully apparent. To specify the last coefficient , we equate the third derivatives of and at . Setting leads to
,
or . Our desired polynomial is therefore
.
This is the Third DegreeTaylor Polynomial of centered at . (If we had a polynomial of higher degree, we would continue to equate higher derivatives of the polynomial and function, evaluated at the point of interest.)
We have written the above denominator as (or ) rather than simply to emphasize the general pattern. Recall factorial notation. .
Using this factorial notation, we can represent the nth degreeTaylor Polynomial of centered at as:
Remark: For a particular choice of function , point of interest , and integer , it may be the case that . In that case, the nth degree Taylor Polynomial of centered at would in fact be a polynomial of degree or less.
As an example, suppose , and :
which is a polynomial of degree 2. In fact, for this example.
Example: Consider the function . Suppose we want to compute the 3rd degree Taylor Polynomial of centered at . Then, we must compute
The 3rd degree Taylor Polynomial of at centered at is therefore
The following graph shows both and on the interval . Note that the natural domain of is while the natural domain of is .
The problems assigned in this worksheet will ask you to construct and study Taylor Polynomials for a variety of functions and points of interest .
Instructions:
- Submit your work as a printed Word document.
- Number each problem clearly and circle answers.
- You should generate all Taylor Polynomials by hand. Then use Matlab to create graphs and make any error calculations.
- Do not use the Symbolic Toolbox for these problems.
- In some of the following exercises you may find the command "max(y)" helpful. The command returns the maximum value in the array y.
Problems:
1. In this problem, you will compare the effects of using Taylor polynomials of the same degree generated by the same function, but at different values for a. Use f(x) = 2sin x + cos(2x).
(a) Find P3(x), the 3rd degree Taylor polynomial of f centered at a = 0.
(b) Find Q3(x), the 3rd degree Taylor polynomial of f centered at a = π/2.
(c) Let x = -4: .01: 4. On a single graph, plot f(x) as a solid line, P3(x) as a dashed line, and Q3(x) as a dotted line. Use the Matlab command axis ([-4,4,-3,3]) to set the horizontal and vertical axes.
(d) From your graphs, which of the Taylor polynomials gives the better approximation of f(x) at x = 0.2? Explain why. Which of the Taylor polynomials gives the better approximation of f(x) at x = 1.2? Explain why.
2. In this problem, you will estimate the accuracy of Taylor polynomials of different degree generated by a function. Use . Recall that the Matlab command for
(a) Find P2(x), the 2nd degree Taylor polynomial of f centered at a = 1.
(b) Let x = -0.4: .01:2.5; and plot f(x) and P2(x) together on the same graph. Use different colors or styles to distinguish your graphs.
(c) Use your graph to estimate (to one decimal place) the largest possible interval around a = 1
in which the graph of P2(x) appears to coincide with the graph of f(x). You may want to zoom in.
(d) For x = -.4: .01:2.5; calculate the maximum value for the error |f(x) – P2(x) | . By hand on your graph in part (b), give a visual representation for this maximum error.
(e) Find P3(x), the 3rd degree Taylor polynomial of f centered at a = 1.
(f) Let x = -.4: .01:2.5; and plot f(x) and P3(x) together on the same graph. Use different colors or styles to distinguish your graphs.
(g) Use your graph to estimate (to one decimal place) the largest possible interval around
a = 1 in which the graph of P3(x) appears to coincide with the graph of f(x).
(h) For x = -.4: .01:2.5; calculate the maximum value for the error |f(x) – P3(x) |. By hand on your graph in part (f), give a visual representation for this maximum error.
3. In this problem, you will determine the order of the Taylor polynomial you need to use in order to achieve a desired accuracy. Use . Recall that the Matlab command for eu is exp(u).
In parts (a) and (b), Pn(x) denotes the nth degree Taylor polynomial, centered at a = 0, of .
(a) Experiment with Taylor polynomials of various degrees until you find the smallest integer n so that the maximum error, |f(x) - Pn(x) |, is less than 0.05 for all x in the array x = -2: .01: 2. Exhibit your polynomial, Pn(x), and the maximum value of the error |f(x) - Pn(x) | for x in the array x = -2: .01: 2
(b) On a single graph plot f(x) and your Pn(x) for the array x = -5: .01: 5;