Chapter 3 Interpolation and polynomial Approximation The computational procedures used in computer software for the evaluation of a li- brary function such as sin (a), cos(a), or e involve polynomial approximation. The state-of-the-art methods use rational functions(which are the quotients of polynom- als). However, the theory of polynomial approximation is suitable for a first course in numerical analysis, and we consider them in this chapter. Suppose that the function f(ar)=e is to be approximated by a polynomial of degree n =2 over the interval - 1,1. The Taylor polynomial is shown in Figure 1.1(a) and can be contrasted with Figure 3.1(a) The Taylor polynomial p(a)=1000000+1000000.C +0.500000r which approximate f(r)=e over [ -1, 1.(b)The Chebyshev approximation g(a) 1.000001129772x+0.532042x2forf(x)= ez over-1,1 3
Chapter 3 Interpolation and Polynomial Approximation The computational procedures used in computer software for the evaluation of a library function such as sin(x), cos(x), or e x , involve polynomial approximation. The state-of-the-art methods use rational functions (which are the quotients of polynomials). However, the theory of polynomial approximation is suitable for a first course in numerical analysis, and we consider them in this chapter. Suppose that the function f(x) = e x is to be approximated by a polynomial of degree n = 2 over the interval [−1, 1]. The Taylor polynomial is shown in Figure 1.1(a) and can be contrasted with −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 0 0.5 1 1.5 2 2.5 3 Figure 1.1(a) The Taylor polynomial p(x)=1+x+0.5x2 which approximates f(x)=ex over [−1,1] y=ex y=1+x+0.5x2 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 0 0.5 1 1.5 2 2.5 3 The Chebyshev approximation q(x)=1+1.129772x+0.532042x2 for f(x)=ex over [−1,1] Figure 1.1(b) y=ex y=q(x) Figure 3.1 (a) The Taylor polynomial p(x) = 1.000000 + 1.000000x+ 0.500000x 2 which approximate f(x) = e x over [−1, 1]. (b) The Chebyshev approximation q(x) = 1.000000 + 1.129772x + 0.532042x 2 for f(x) = e x over [−1, 1]. 3
Figure 1.2 The graph of the collocation polynomial that passes through(1,2),(2,1),(3,5),(4.,6),and(5,1) the Chebyshev approximation in Figure 1.1(b). The maximum error for the Taylor approximation is 0.218282, whereas the maximum error for the Chebyshev polynomial is 0.056468. In this chapter we develop the basic theory needed to investigate these matters An associated problem involves construction of the collocation polynomial. Given n+l points in the plane (no two of which are aligned vertically), the collocation polynomial is the unique polynomial of degree n that passes through the points. In cases where data are known to a high degree of precision, the collocation polynomial is sometimes used to find a polynomial that passes through the given data points A variety of methods can be used to construct the collocation polynomial: solving a linear system for its coefficients, the use of Lagrange coefficient polynomials, and the construction of a divided differences are important for a practitioner of numerical analysis to know. For example, the collocation polynomial of degree n= 4 that passes through the five points(1, 2),(2, 1),( 3, 5), (4, 6)and(5, 1)is Pa)≈5x4-82x3+427x2-806x+504 and a graph showing both the points and the polynomial is given in Figure 1.2 3.1 Taylor Series and Calculation of functions Limit processes are the basis of calculus. For example, the derivative f(a) f(r+h)-f(a h the limit of the difference quotient where both the numerator and the denomina go to zero. A Taylor series illustrates another type of limit process. In the case
1 1.5 2 2.5 3 3.5 4 4.5 5 0 1 2 3 4 5 6 7 Figure 1.2 The graph of the collocation polynomial that passes through (1,2), (2,1), (3,5), (4,6), and ((5,1) y=P(x) Figure 1.2 The graph of the collocation polynomial that passes through (1,2), (2,1), (3,5), (4,6), and (5,1). the Chebyshev approximation in Figure 1.1(b). The maximum error for the Taylor approximation is 0.218282, whereas the maximum error for the Chebyshev polynomial is 0.056468. In this chapter we develop the basic theory needed to investigate these matters. An associated problem involves construction of the collocation polynomial. Given n + 1 points in the plane (no two of which are aligned vertically), the collocation polynomial is the unique polynomial of degree ≤ n that passes through the points. In cases where data are known to a high degree of precision, the collocation polynomial is sometimes used to find a polynomial that passes through the given data points. A variety of methods can be used to construct the collocation polynomial: solving a linear system for its coefficients, the use of Lagrange coefficient polynomials, and the construction of a divided differences are important for a practitioner of numerical analysis to know. For example, the collocation polynomial of degree n = 4 that passes through the five points (1, 2),(2, 1),(3, 5),(4, 6) and (5, 1) is P(x) = 5x 4 − 82x 3 + 427x 2 − 806x + 504 24 , and a graph showing both the points and the polynomial is given in Figure 1.2. 3.1 Taylor Series and Calculation of Functions Limit processes are the basis of calculus. For example, the derivative f 0 (x) = limh→0 f(x + h) − f(x) h is the limit of the difference quotient where both the numerator and the denominator go to zero. A Taylor series illustrates another type of limit process. In the case 4
an infinite number of terms is added together by taking the limit of certain partial sums. An important application is their use to represent the elementary functions sin(a), cos(a), ez, In (r), etc. Table 1.1 gives several of the common Taylor series expan sions. The partial sums can be accumulated until an approximation to the function is obtained that has the accuracy specified. Series solutions are used in the areas of engineering and physics Table 1.1 Taylor Series Expansions for Some Common Functions in(a 3!5!7! 2!+4!-6! r an r=1+x+-+-+-,+ for all r In(1+a) 2+3-4 1<x≤1 rotan(a) 357 (1+x)P=1 p(p-1) rl< We want to learn how a finite sum can be used to obtain a good approximation to an infinite sum. For illustration we shall use the exponential series in Table 1.1 to compute the number e=e, which is the base of the natural logarithm and exponential functions. Here we choose r 1 and use the series +1+2+3+4 The definition for the sum of an infinite series in section 1. 1 requires that the partial sums Sn tend to a limit. The values of these sums are given in Table 1.2 A natural way to think about the power series representation of a function is to view the expansion as the limiting case of polynomials of increasing degree. This needs to be made precise. What degree should be chosen for the polynomial, and how do we calculate the coefficients for the powers of a in the polynomial? Theorem 1.1 answers these questions Table 1.2 Partial Sums S, Used to Determine e
an infinite number of terms is added together by taking the limit of certain partial sums. An important application is their use to represent the elementary functions: sin(x), cos(x), ex , ln(x), etc. Table 1.1 gives several of the common Taylor series expansions. The partial sums can be accumulated until an approximation to the function is obtained that has the accuracy specified. Series solutions are used in the areas of engineering and physics. Table 1.1 Taylor Series Expansions for Some Common Functions sin(x) = x − x 3 3! + x 5 5! − x 7 7! + · · · for all x cos(x) = 1 − x 2 2! + x 4 4! − x 6 6! + · · · for all x e x = 1 + x + x 2 2! + x 3 3! + x 4 4! + · · · for all x ln(1 + x) = x − x 2 2 + x 3 3 − x 4 4 + · · · − 1 ≤ x ≤ 1 arctan(x) = x − x 3 3 + x 5 5 − x 7 7 + · · · − 1 ≤ x ≤ 1 (1 + x) p = 1 + px + p(p − 1) 2! x 2 + · · · for |x| < 1 We want to learn how a finite sum can be used to obtain a good approximation to an infinite sum. For illustration we shall use the exponential series in Table 1.1 to compute the number e = e 1 , which is the base of the natural logarithm and exponential functions. Here we choose x = 1 and use the series e 1 = 1 + 1 1! + 1 2 2! + 1 3 3! + 1 4 4! + · · · + 1 k k! + · · · , The definition for the sum of an infinite series in section 1.1 requires that the partial sums SN tend to a limit. The values of these sums are given in Table 1.2. A natural way to think about the power series representation of a function is to view the expansion as the limiting case of polynomials of increasing degree. This needs to be made precise. What degree should be chosen for the polynomial, and how do we calculate the coefficients for the powers of x in the polynomial? Theorem 1.1 answers these questions. Table 1.2 Partial Sums Sn Used to Determine e 5
2 2.5 3 2.666666666666 4 2.708333333333 2.716666666666 2.718805555555 2.718253968254 2.718281525573 102.7182831801146 2.718281826 12 2.718281828286 13 2.718281828447 14 2.718281828458 15 2.718281828459 Theorem 1.1(Taylor Polynomial Approximation). Assume that f E CN+a, bl and to∈[a,b] is a fixed value.Ifr∈[a,b],then ∫(x)=P(x)+EN(x) where PN(a) is a polynomial that can be used to approximate f(a) f(x)≈PN(x) f()(o) ) (32) The error term EN(r) has the form f+(c) (N+1)! for some value c= c(a)that lies between s and To Proof. The proof is left as an exercise Relation(1.2)indicates how the coefficients of the Taylor polynomial are calculated Although the error term(1.3)involves a similar expression, notice that f(N+l(c)is to be evaluated at an undetermined number c that depends on the value of a. For this reason we do not try to evaluate EN(c); it is used to determine a bound for the accuracy of the approximation Example 1.1 Show why 15 terms are all that are needed to obtain the 13-digit ap- proximation e=2.718281828459 in Table 1. 2 Expand f(a)=e in a Taylor polynomial of degree 15 using the fixed value Io=0 and involving the powers(a-O)=rk. The derivatives required are f(c)=f"(a)
n Sn = 1 + 1 1! + 1 2! + · · · + 1 n! 0 1.0 1 2.0 2 2.5 3 2.666666666666. . . 4 2.708333333333. . . 5 2.716666666666. . . 6 2.718805555555. . . 7 2.718253968254. . . 8 2.718278769841. . . 9 2.718281525573. . . 10 2.718281801146. . . 11 2.718281826199. . . 12 2.718281828286. . . 13 2.718281828447. . . 14 2.718281828458. . . 15 2.718281828459. . . Theorem 1.1 (Taylor Polynomial Approximation). Assume that f ∈ C N+1[a, b] and x0 ∈ [a, b] is a fixed value. If x ∈ [a, b], then f(x) = PN (x) + EN (x), (3.1) where PN (x) is a polynomial that can be used to approximate f(x): f(x) ≈ PN (x) = X N k=0 f (k) (x0) k! (x − x0) k . (3.2) The error term EN (x) has the form EN (x) = f (N+1)(c) (N + 1)! (x − x0) N+1 (3.3) for some value c = c(x) that lies between x and x0. Proof. The proof is left as an exercise. Relation (1.2) indicates how the coefficients of the Taylor polynomial are calculated. Although the error term (1.3) involves a similar expression, notice that f (N+1)(c) is to be evaluated at an undetermined number c that depends on the value of x. For this reason we do not try to evaluate EN (x); it is used to determine a bound for the accuracy of the approximation. Example 1.1 Show why 15 terms are all that are needed to obtain the 13-digit approximation e = 2.718281828459 in Table 1.2. Expand f(x) = e x in a Taylor polynomial of degree 15 using the fixed value x0 = 0 and involving the powers (x − 0)k = x k . The derivatives required are f 0 (x) = f”(x) = 6
fa6)=e The first 15 derivatives are used to calculate the coefficients ak =e0/k and are used to write P5(x)=1+x+a+n+ 5! (3.4) Setting a= l in(4)m gives the partial sum S15= Pis(1). The remainder term is needed to show the accuracy of the approximation (16) C 16! Since we chose To=0 and a= 1, the value c lies between them(i.e implies that ec e. Notice that the partial sums in Table 4.2 are bounded above by 3. Combining these two inequalities yields e IThe curvature K of a graph y=f(a)at(ao, yo)is defined by K=If"(o)V/(1+U'(co)12)3/2
· · · = f (16) = e x . The first 15 derivatives are used to calculate the coefficients ak = e 0/k! and are used to write P15(x) = 1 + x + x 2 2! + x 3 3! + · · · + x 15 15!. (3.4) Setting x = 1 in (4)m gives the partial sum S15 = P15(1). The remainder term is needed to show the accuracy of the approximation: E15 = f (16)(c)x 16 16! . (3.5) Since we chose x0 = 0 and x = 1, the value c lies between them (i.e., 0 < c < 1), which implies that e c < e1 . Notice that the partial sums in Table 4.2 are bounded above by 3. Combining these two inequalities yields e c < 3, which is used in the following calculation |E15(1)| = |f (16)(c)| 16! ≤ e c 16! < 3 16! < 1.433844 × 10−13 . Therefore, all the digits in the approximation e ≈ 2.718281828459 are correct, because the actual error (whatever it is) must be less than 2 in the thirteenth decimal place. Instead of giving a rigorous proof of Theorem 4.1, we shall discuss some of the features of the approximation; the reader can look in any standard reference text on calculus for more details. For illustration we again use the function f(x) = e x and the value x0 = 0. From elementary calculus we know that the slope of the curve y = e x at the same formula that would be obtained if we used N = 1 in Theorem 1.1; that is, P1(x) = f(0) + f 0 (0)x/1! = 1 + x. Therefore, P1(x) is the equation of the tangent line to the curve. The graphs are shown in Figure 1.3. Observe that the approximation e x ≈ 1 + x is good near the center x0 = 0 and that the distance between the curves grows as x moves away from 0. Notice that the slopes of the curves agree at (0, 1). In calculus we learned that the second derivative indicates whether a curve is concave up or down. The study of curvature1 shows that if two curves y = f(x) and y = g(x) have the property that f(x0) = g(x0), f0 (x0) = g 0 (x0), and f 00(x0) = g 00(x0) then they have the same curvature at x0. This property would be desirable for a polynomial function that approximate f(x). Corollary 4.1 shows that the Taylor polynomial has this property for N ≥ 2. 1The curvature K of a graph y = f(x) at (x0, y0) is defined by K = |f”(x0)|/(1 + [f 0 (x0)]2 ) 3/2 . 7
Figure 1.3 Tha graphs of y-e and y-P,(=1+x. Figure 1. 3 The graphs of y= e and y= Pi(a)=1+a Corollary 1.1. If PN(a) is the Taylor polynomial of degree N given in Theorem 1. 1. then (3.6) Proof. Set r = To in equation(1.2)and(1.3), and the result is Pn(ro)=f(ro). Thus statement(1.6) is true for k =0. Now differentiate the right-hand side of (1.2) and get PN()=yf()(ro) f(+1)(xo) (h O)(x-x0)k-1 kl (3.7) Set a=ro in(1.7) to obtain PN(ro)=f(ro). Thus statement(1.6) is true for k=1 Successive differentiations of(1.7)will establish the other identities in(1.6). The detail are left as an exercise Applying Corollary 1. 1, we see that y= P2(a)has the properties f( o)=P2( o), f(ro) P2(o), and f"(ro)=P2(o); hence the graphs have the same curvature at To. For ey ample, consider f(r)=e and P2()=1+r+x/ 2. The graphs are shown in Figure 1. 4 and it is seen that they curve up in the same fashion at(0, 1) Figure 1. 4 The graphs of yae and yP2(x-1+**xr2
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −1 0 1 2 3 4 5 6 7 8 Figure 1.3 The graphs of y=ex and y=P1 (x)=1+x. x y y=ex y=P1 (x) Figure 1.3 The graphs of y = e x and y = P1(x) = 1 + x. Corollary 1.1. If PN (x) is the Taylor polynomial of degree N given in Theorem 1.1, then P (k) N (x0) = f (k) (x0) for k = 0, 1, . . . , N (3.6) Proof. Set x = x0 in equation (1.2) and (1.3), and the result is Pn(x0) = f(x0). Thus statement (1.6) is true for k = 0. Now differentiate the right-hand side of (1.2) and get P 0 N (x) = X N k=1 f (k) (x0) (k − 1)!(x − x0) k−1 = N X−1 k=0 f (k+1)(x0) k! (x − x0) k . (3.7) Set x = x0 in (1.7) to obtain P 0 N (x0) = f 0 (x0). Thus statement (1.6) is true for k = 1. Successive differentiations of (1.7) will establish the other identities in (1.6). The details are left as an exercise. Applying Corollary 1.1, we see that y = P2(x) has the properties f(x0) = P2(x0), f0 (x0) = P 0 2 (x0), and f 00(x0) = P 00 2 (x0); hence the graphs have the same curvature at x0. For example, consider f(x) = e x and P2(x) = 1 + x + x 2/2. The graphs are shown in Figure 1.4 and it is seen that they curve up in the same fashion at (0, 1). −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 0 1 2 3 4 5 6 7 8 Figure 1.4 The graphs of y=ex and y=P2 (x)=1+x+x2 /2. x y y=ex y=P2 (x) y=P2 (x) y=ex 8
Figure 1.4 The graphs of y=e and y= P2(a)=1+2+2/ 2 In the theory of approximation, one seeks to find an accurate polynomial approxima- tion to the analytic function2 f(a)over [ a, b]. This is one technique used in developing computer software. The accuracy of a Taylor polynomial is increased when N large. The accuracy of any given polynomial will generally decrease as the value of . r moves away from the center o. Hence we must choose N large enough and restrict the maximum value of r- o so that the error does not exceed a specified bound. If we choose the interval width to be 2R and To in the center (i.e, lr -rol R), the absolute value of the error satisfies the relation error=|EN(x)≤ MRN+ (N+1)! where m≤max{f(+1(2):xo-R≤z≤xo+R}. Ifn is fixed and the derivatives ormly bounded, the error bound in(1.8)is proportional to R +/(N+1)! and decreases if R goes to zero as n gets large. Table 1.3 shows how the choices of these two parameters affect the accuracy of approximation e a PN(a)over the interval r< r The error is smallest when N is largest and R smallest. Graphs for P2, P3 and P4 are given in Figure 1.5 Table 1.3 Values for the Error Bound error eRN+/(N + 1)! Using the Ap- proximation e N PN(a) for r R=20,R=1.5,R=1.0,R=0.5, |≤20x≤1.5|x≤ x≤0.5 e≈P(x)0.656804990.070901720.003773900078 e2≈P(x)0.8765837|0.015193231009300016 e≈P(x)0.046914640.002848730.0004240000006 e≈P(x)0010425480007900001900000 1.5 The graphs of yue, yup? o) yPa o and yP,O The function f(a) is analytic at ro if it has continuous derivatives of all orders and can be repre- sented as a Taylor series in an interval about o
Figure 1.4 The graphs of y = e x and y = P2(x) = 1 + x + x 2/2. In the theory of approximation, one seeks to find an accurate polynomial approximation to the analytic function2 f(x) over [a, b]. This is one technique used in developing computer software. The accuracy of a Taylor polynomial is increased when we choose N large. The accuracy of any given polynomial will generally decrease as the value of x moves away from the center x0. Hence we must choose N large enough and restrict the maximum value of |x − x0| so that the error does not exceed a specified bound. If we choose the interval width to be 2R and x0 in the center (i.e., |x − x0| < R), the absolute value of the error satisfies the relation |error| = |EN (x)| ≤ MRN+1 (N + 1)!. (3.8) where M ≤ max{|f (N+1)(z)| : x0 − R ≤ z ≤ x0 + R}. If N is fixed and the derivatives are uniformly bounded, the error bound in (1.8) is proportional to RN+1/(N + 1)! and decreases if R goes to zero as N gets large. Table 1.3 shows how the choices of these two parameters affect the accuracy of approximation e x ≈ PN (x) over the interval |x| ≤ R. The error is smallest when N is largest and R smallest. Graphs for P2, P3 and P4 are given in Figure 1.5. Table 1.3 Values for the Error Bound |error| < eRRN+1/(N + 1)! Using the Approximation e x ≈ PN (x) for |x| < R R = 2.0, |x| ≤ 2.0 R = 1.5, |x| ≤ 1.5 R = 1.0, |x| ≤ 1.0 R = 0.5, |x| ≤ 0.5 e x ≈ P5(x) 0.65680499 0.07090172 0.00377539 0.00003578 e x ≈ P6(x) 0.18765837 0.01519323 0.00053934 0.00000256 e x ≈ P7(x) 0.04691464 0.00284873 0.00006742 0.00000016 e x ≈ P8(x) 0.01042548 0.00047479 0.00000749 0.00000001 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −1 0 1 2 3 4 5 6 7 8 Figure 1.5 The graphs of y=ex , y=P2 (x), y=P3 (x) and y=P4 (x). x y y=ex y=P4 (x) y=P3 (x) y=P2 (x) 2The function f(x) is analytic at x0 if it has continuous derivatives of all orders and can be represented as a Taylor series in an interval about x0. 9
Figure 1. 5 The graphs of y =e, y= P2(),y= P(), and y= P(a) Example 1.2 Establish the error bounds for the approximation e a Ps(ar)on each of the intervals r≤10andx|≤0.5 If =|< 1.0. then letting R=1.0 and Ife)(c)l=lecl M in(1. 8)implies error=|Es(x)≤ 10(1.0) 9!≈0.00004 If =| <0.5, then letting R=0.5 and If9(c)l= le l <e0.s=M in(1. 8)implies that error=|E(x)≤ (0.5)9 ≈0.00000001 Example 1.3. If f(r)=er, show that N=9 is the smallest integer, so that the error= EN(a)l < 0.0000005 for x in [-1, 1]. Hence P9(r) can be used to compute approximate value of e that will be accurate in the sixth decimal place We need to find the smallest integer n so that erro =|E(x)s(1)M+1 (N+1)! ≈0.0000005 igure 1. The graph of the eoryox-e-Pg(). y=E间x Figure 1.6 The graph of the error y= Eg(a)=e-Pg(a) In Example 1.2 we saw that N=& was too small, so we try N=9 and discover that EN(a)se(1)9+/(9+1)!<0.000000749. This value is slightly larger than desired hence we would be likely to choose N=10. But we used ec< e as a crude estimate in finding the error bound. Hence 0.000000749 is a little larger than the actual error Figure 1.6 shows a graph of Eg(ar)=e-Pg(ar). Notice that the maximum vertical range is about 3 x 10 and occurs at the right end point (1, Eg(1)). Indeed, the maximum error on the interval is Eg(1)=2.718281828-2718281526 N 3.024 x10. Therefore, N=9 is justifi
Figure 1.5 The graphs of y = e x , y = P2(x), y = P3(x), and y = P4(x). Example 1.2 Establish the error bounds for the approximation e x ≈ P8(x) on each of the intervals |x| ≤ 1.0 and |x| ≤ 0.5. If |x| ≤ 1.0. then letting R = 1.0 and |f (9)(c)| = |e c | ≤ e 1.0 = M in (1.8) implies that |error| = |E8(x)| ≤ e 1.0 (1.0)9 9! ≈ 0.00000749. If |x| ≤ 0.5, then letting R = 0.5 and |f (9)(c)| = |e c | ≤ e 0.5 = M in (1.8) implies that |error| = |E8(x)| ≤ e 0.5 (0.5)9 9! ≈ 0.00000001. Example 1.3. If f(x) = e x , show that N = 9 is the smallest integer, so that the |error| = |EN (x)| ≤ 0.0000005 for x in [−1, 1]. Hence P9(x) can be used to compute approximate value of e x that will be accurate in the sixth decimal place. We need to find the smallest integer N so that |error| = |EN (x)| ≤ e c (1)N+1 (N + 1)! ≈ 0.0000005. −1.5 −1 −0.5 0 0.5 1 1.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 10−5 Figure 1.6 The graph of the error y=E9 (x)=ex−P9 (x). x y y=E9 (x) Figure 1.6 The graph of the error y = E9(x) = e x − P9(x). In Example 1.2 we saw that N = 8 was too small, so we try N = 9 and discover that |EN (x)| ≤ e 1 (1)9+1/(9 + 1)! ≤ 0.000000749. This value is slightly larger than desired; hence we would be likely to choose N = 10. But we used e c ≤ e 1 as a crude estimate in finding the error bound. Hence 0.000000749 is a little larger than the actual error. Figure 1.6 shows a graph of E9(x) = e x−P9(x). Notice that the maximum vertical range is about 3 × 10−7 and occurs at the right end point (1, E9(1)). Indeed, the maximum error on the interval is E9(1) = 2.718281828 − 2.718281526 ≈ 3.024 × 10−7 . Therefore, N = 9 is justified. 10
3.1.1 Methods for Evaluating a Polynomial There are several mathematically equivalent ways to evaluate a polynomial. Consider for example, the function f(x)=(x-1)3 (3.9) The evaluation of f will require the use of an exponential function. Or the binomial formula can be used to expand f(a) in powers of a 0-()+y=2+2++2-+10 Horner's method(see Section 1. 1), which is also called nested multiplication, can be used to evaluate the polynomial in(1.10). When applied to formula(1.10), nested multiplication permits us to write f(x)=(-8)x+28)x-56)x+70)x-56)x+28)x-8)x+1.(3.11) To evaluate f(ar) now requires seven multiplications and eight additions or subtrac tions. The necessity of using an exponential function to evaluate the polynomial has now been eliminated We end this section with the theorem that relates the Taylor series in Table 1.1 and the polynomials of Theorem 1.1 Theorem 1.2(Taylor Series). Assume that f(ar) is analytic and has continuous derivatives of all order N=1.2 · on an interva ral(a, b)containing To. Suppose that the Taylor polynomial(1.2) tend to a limit S(a)=lim PN(a)=lim (a-co) k=0 k! then f(a) has the Taylor series expansion Proof. This follows directly from the definition of convergence of series in Section 1.1 This limit condition is often stated by saying that the error term must go to zero as N goes to infinite. Therefore, a necessary and sufficient condition for(1.13)to hold is that lim EN(a)=lim 3.14) where c depends on N and a 11
3.1.1 Methods for Evaluating a Polynomial There are several mathematically equivalent ways to evaluate a polynomial. Consider, for example, the function f(x) = (x − 1)8 . (3.9) The evaluation of f will require the use of an exponential function. Or the binomial formula can be used to expand f(x) in powers of x: f(x) = X 8 k=0 Ã 8 k ! x 8−k (−1)k = x 8−8x 7+28x 6−56x 5+70x 4−56x 3+28x 2−8x+1. (3.10) Horner’s method (see Section 1.1), which is also called nested multiplication, can be used to evaluate the polynomial in (1.10). When applied to formula (1.10), nested multiplication permits us to write f(x) = (((((((x − 8)x + 28)x − 56)x + 70)x − 56)x + 28)x − 8)x + 1. (3.11) To evaluate f(x) now requires seven multiplications and eight additions or subtractions. The necessity of using an exponential function to evaluate the polynomial has now been eliminated. We end this section with the theorem that relates the Taylor series in Table 1.1 and the polynomials of Theorem 1.1. Theorem 1.2 (Taylor Series). Assume that f(x) is analytic and has continuous derivatives of all order N = 1, 2, . . ., on an interval (a, b) containing x0. Suppose that the Taylor polynomial (1.2) tend to a limit S(x) = limN→∞ PN (x) = limN→∞ X N k=0 f (k) (x0) k! (x − x0) k , (3.12) then f(x) has the Taylor series expansion f(x) = X∞ k=0 f (k) (x0) k! (x − x0) k . (3.13) Proof. This follows directly from the definition of convergence of series in Section 1.1. This limit condition is often stated by saying that the error term must go to zero as N goes to infinite. Therefore, a necessary and sufficient condition for (1.13) to hold is that lim N→∞ EN (x) = limN→∞ f (N+1)(c)(x − x0) N+1 (N + 1)! = 0, (3.14) where c depends on N and x. 11
3.1.2 Exercises for Taylor Series and Calculation of Functions 1. Let f(a)=sin(a)and apply Theorem 1.1 (a) Use to=0 and find P,(r), P7(ar). and Pg(ar) (b) Show that if ar s l then the approximation si()x-3+可-7+g has the error bound eo(x)<1/10!≤2.75574×10-7 (c)Use To=T/4 and find P,(r), which involves powers of(a-/4) 2. Let f(r)=cos(a)and apply Theorem 1.1 (a) Use ao ==0 and find P(a), P6(a)and Ps(a) (b)Show that if al l then the approximation cos()≈1-a+ 4!6!8! has the error bound e(x)<1/9≤275574×10-6 (c) Use to=T/4 and find P(a), which involves powers of (a-T/4 3. Does f()=21/2 have a Taylor series expansion about Io=0?Justify your answer. Does the function f(a)=al/2 have a Taylor series expa ansion about 1? Justify your answe 4.(a)Find the Taylor polynomial of degree N=5 for f(a)=1/(1+a) expanded about To=0 b) Find the error term Es()for the polynomial in part(a) 5. Find the Taylor polynomial of degree N=3 for f(a)=e-x/ expanded 0 6. Find the Taylor polynomial of degree N=3, P3(a), for f(c)=x-2.x2+2.c expanded about o= 1. Show that f(a)= P3(ar) 7.(a) Find the Taylor polynomial of degree N=3 for f(c)=a/2 expanded 4 (b) Find the Taylor polynomial of degree N=3 for f(a)=x/2 expanded 9. (c)Determine which of the polynomials in parts(a)and(b) best approxi- mates(6.5)/ 8. Use f(a)=(2+x)/2 and apply Theorem 1.1 (b) Use P3(a)to find an approximation to 31e about to (a) Find the Taylor polynomial P3(a) expanded (c) Find the maximum value of If(4)(c)) on the interval I <c<3 and find bound for E3(r) 9. Determine the degree of the Taylor polynomial PN(a) expanded about o=0 that should be used to approximate eo. so that the error is less than 10 10. Determine the degree of the Taylor polynomial PN(a) expanded about
3.1.2 Exercises for Taylor Series and Calculation of Functions 1. Let f(x) = sin(x) and apply Theorem 1.1. (a) Use x0 = 0 and find P5(x), P7(x). and P9(x). (b) Show that if |x| ≤ 1 then the approximation sin(x) ≈ x − x 3 3! + x 5 5! − x 7 7! + x 9 9! has the error bound E9(x) < 1/10! ≤ 2.75574 × 10−7 . (c) Use x0 = π/4 and find P5(x), which involves powers of (x − π/4). 2. Let f(x) = cos(x) and apply Theorem 1.1. (a) Use x0 == 0 and find P4(x), P6(x) and P8(x). (b) Show that if |x| ≤ 1 then the approximation cos(x) ≈ 1 − x 2 2! + x 4 4! − x 6 6! + x 8 8! has the error bound E8(x) < 1/9! ≤ 2.75574 × 10−6 . (c) Use x0 = π/4 and find P4(x), which involves powers of (x − π/4). 3. Does f(x) = x 1/2 have a Taylor series expansion about x0 = 0? Justify your answer. Does the function f(x) = x 1/2 have a Taylor series expansion about x0 = 1? Justify your answer. 4. (a) Find the Taylor polynomial of degree N = 5 for f(x) = 1/(1 + x) expanded about x0 = 0. (b) Find the error term E5(x) for the polynomial in part (a). 5. Find the Taylor polynomial of degree N = 3 for f(x) = e −x 2/2 expanded about x0 = 0. 6. Find the Taylor polynomial of degree N = 3, P3(x), for f(x) = x 3 − 2x 2 + 2x expanded about x0 = 1. Show that f(x) = P3(x). 7. (a) Find the Taylor polynomial of degree N = 3 for f(x) = x 1/2 expanded about x0 = 4. (b) Find the Taylor polynomial of degree N = 3 for f(x) = x 1/2 expanded about x0 = 9. (c) Determine which of the polynomials in parts (a) and (b) best approximates (6.5)1/2 . 8. Use f(x) = (2 + x) 1/2 and apply Theorem 1.1. (a) Find the Taylor polynomial P3(x) expanded about x0 = 2. (b) Use P3(x) to find an approximation to 31/2 . (c) Find the maximum value of |f (4)(c)| on the interval 1 ≤ c ≤ 3 and find a bound for |E3(x)|. 9. Determine the degree of the Taylor polynomial PN (x) expanded about x0 = 0 that should be used to approximate e 0.1 so that the error is less than 10−6 . 10. Determine the degree of the Taylor polynomial PN (x) expanded about 12