9.3 Taylor’s Theorem: Error Analysis QuickTime™ and a decompressor are needed to see this picture. 2 7 1 1 2 yes no yes yes no Finding Truncation Error in a Taylor Polynomial Graph the function y1 = ln (1 + x) and it’s corresponding Taylor Polynomial x2 x3 x4 x5 y2 = x + + 2 3 4 5 Finding Truncation Error in a Taylor Polynomial Graph the function y1 = ln (1 + x) and it’s corresponding 2 3 4 5 Taylor Polynomial y 2 = x - x + x - x - x 2 3 4 5 Finding Truncation Error in a Taylor Polynomial To find the error between the functions, graph y3 = abs (y2 – y1). Finding Truncation Error in a Taylor Polynomial To find the error between the functions, graph y3 = abs (y2 – y1). Where is the error the smallest? Use Table to see where truncation error is least on (-1,1) Finding Error in a Taylor Polynomial Graph the function y1 = sin x and it’s corresponding Taylor Polynomial y = x - x6 and find the interval in which the 3 2 Taylor polynomial is accurate to the thousandths place. Finding Error in a Taylor Polynomial The third order Taylor Polynomial for y = sin x is accurate to the thousandths place on the interval (-.65, .65). Graph y3 = abs (y1(x) – y2(x)), and y4 = .001. Taylor series are used to estimate the value of functions (at least theoretically - now days we can usually use the calculator or computer to calculate directly.) An estimate is only useful if we have an idea of how accurate the estimate is. When we use part of a Taylor series to estimate the value of a function, the end of the series that we do not use is called the remainder. If we know the size of the remainder, then we know how close our estimate is. For a geometric series, this is easy: ex. 2: 1 1,1 . Use 1 x x x to approximate 2 over 1 x 2 4 6 Since the truncated part of the series is: x8 x10 x12 , x8 the truncation error is x x x , which is . 2 1 x 8 10 12 When you “truncate” a number, you drop off the end. Of course this is also trivial, because we have a formula that allows us to calculate the sum of a geometric series directly. Taylor’s Theorem with Remainder If f has derivatives of all orders in an open interval I containing a, then for each positive integer n and for each x in I: f a f n a 2 f x f a f a x a x a x a n Rn x 2! n! Lagrange Form of the Remainder Rn x c x a n1 n 1! f n 1 Remainder after partial sum Sn where c is between a and x. Lagrange Form of the Remainder Rn x c x a n1 n 1! f n 1 Remainder after partial sum Sn where c is between a and x. This is also called the remainder of order n or the error term. Note that this looks just like the next term in the series, but “a” has been replaced by the number “c” in f n 1 c . This seems kind of vague, since we don’t know the value of c, but we can sometimes find a maximum value for f n 1 c . Lagrange Form of the Remainder Rn x c x a n1 n 1! f n 1 If M is the maximum value of between a and x, then: Taylor’s Inequality M n 1 Rn x xa n 1! f n 1 x on the interval Note this is not This is that called Taylor’s the formula that is in Inequality. our book. It is from another textbook. ex. 2: Prove that k 0 1 k x 2 k 1 2k 1! , which is the Taylor series for sin x, converges for all real x. Since the maximum value of sin x or any of it’s derivatives is 1, for all real x, M = 1. Rn x 1 n 1! x0 n 1 Taylor’s Inequality M n 1 Rn x xa n 1! n 1 x n 1! n 1 x lim 0 n n 1! so the series converges. ex. 5: x2 Find the Lagrange Error Bound when x is used 2 to approximate ln 1 x and x 0.1 . f x ln 1 x f x 1 x 1 f x 1 x 2 f x 2 1 x 3 x2 f x 0 x R2 x 2 2 On the interval .1,.1 , 1 x 3 decreases, so its maximum value occurs at the left end-point. M 2 1 .13 2 3 2.74348422497 .9 f 0 f 0 2 f x f 0 x x R2 x 1 2! Remainder after 2nd order term ex. 5: x2 Find the Lagrange Error Bound when x is used 2 to approximate ln 1 x and x 0.1 . Taylor’s Inequality M n 1 Rn x xa n 1! 2 On the interval .1,.1 , 1 x 3 decreases, so its maximum value occurs at the left end-point. 2.7435 .1 Rn x 3! 3 Rn x 0.000457 Lagrange Error Bound M 2 1 .13 2 3 2.74348422497 .9 x2 x error 2 Error is x ln 1 x .1 .0953102 .1 .1053605 .105 .095 .000310 .000361 less than error bound. Example using Taylor’s Theorem with Remainder For approximately what values of x can you replace sin x by 3 x with an error magnitude no greater than 1 x 10-3 ? x3! Since f 5 R 4 (x) c = x 5 5! x x cos c 1, then 5 1 x 10 - 3 .12 .65 Taylor’s Theorem with Remainder Taylor’s Theorem with Remainder works well with the functions y = sin x and y = cos x because |f (n+1)(c)| ≤ 1. lim R n (x) = f c x n + 1! n+1 n n 1 n 1 x lim 0 n (n 1)! Note: Factorial growth in the denominator is larger than the exponential growth in the numerator. 100n 100 Ex : lim = n n+1 ! 1 100 2 100 ... 3 100 100 100 101 ... 100 ... 7 10 Since | Rn(x)| 0 then the Taylor Series converges as n → Euler’s Formula An amazing use for infinite series: x 2 x3 x 4 e 1 x 2! 3! 4! x Substitute xi for x. xi 2 xi 3 xi 4 xi 5 xi 6 e 1 xi 2! 3! 4! 5! 6! xi x 2i 2 x3i 3 x 4i 4 x5i 5 x 6i 6 e 1 xi 2! 3! 4! 5! 6! xi x 2 x3i x 4 x5i x 6 e 1 xi Factor out the i terms. 2! 3! 4! 5! 6! xi 2 4 6 x x x x3 x5 xi e 1 i x 2! 4! 6! 3! 5! 2 4 6 x x x x3 x5 xi e 1 i x 2! 4! 6! 3! 5! This is the series for cosine. e xi cos x i sin x This is the series for sine. Let x ei cos i sin ei 1 i 0 i e 1 0 This amazing identity contains the five most famous numbers in mathematics, and shows that they are interrelated.