Approximation of a function by a polynomial function

1 Approximation of a function by a polynomial function 1. step: Assuming that f(x) is differentiable at x = a, from the picture we see: ๐‘“(๐‘ฅ) = ๐‘“(๐‘Ž) +...
Author: Darleen Cole
9 downloads 0 Views 874KB Size
1

Approximation of a function by a polynomial function 1. step: Assuming that f(x) is differentiable at x = a, from the picture we see: ๐‘“(๐‘ฅ) = ๐‘“(๐‘Ž) + โˆ†๐‘“ โ‰ˆ ๐‘“(๐‘Ž) + ๐‘“โ€ฒ(๐‘Ž)โˆ†๐‘ฅ

Linear approximation of f(x) at point x around x = a ๐‘“(๐‘ฅ) = ๐‘“(๐‘Ž) + ๐‘“โ€ฒ(๐‘Ž)(๐‘ฅ โˆ’ ๐‘Ž) ๐‘…๐‘’๐‘š๐‘Ž๐‘–๐‘›๐‘‘๐‘’๐‘Ÿ ๐‘น = ๐‘“(๐‘ฅ) โˆ’ ๐‘“(๐‘Ž) โˆ’ ๐‘“โ€ฒ(๐‘Ž)(๐‘ฅ โˆ’ ๐‘Ž) will determine magnitude of error Letโ€™s try to get better approximation of f(x). Letโ€™s assume that f(x) has all derivatives at x = a. Letโ€™s assume there is a possible power series expansion of f(x) around a. โˆž 2

3

๐‘“(๐‘ฅ) = ๐‘0 + ๐‘1 (๐‘ฅ โˆ’ ๐‘Ž) + ๐‘2 (๐‘ฅ โˆ’ ๐‘Ž) + ๐‘3 (๐‘ฅ โˆ’ ๐‘Ž) + โ‹ฏ = โˆ‘ ๐‘๐‘› (๐‘ฅ โˆ’ ๐‘Ž)๐‘›

โˆ€ ๐‘ฅ ๐‘Ž๐‘Ÿ๐‘œ๐‘ข๐‘›๐‘‘ ๐‘Ž

๐‘›=0

n 0 1 2 3 โ‹ฎ n โ‹ฎ

๐‘“ (๐‘›) (๐‘ฅ) ๐‘“ (๐‘ฅ) = ๐‘0 + ๐‘1 (๐‘ฅ โˆ’ ๐‘Ž) + ๐‘2 (๐‘ฅ โˆ’ + ๐‘3 (๐‘ฅ โˆ’ ๐‘Ž)3 + โ‹ฏ ๐‘“โ€ฒ(๐‘ฅ) = ๐‘1 + 2๐‘2 (๐‘ฅ โˆ’ ๐‘Ž) + 3๐‘3 (๐‘ฅ โˆ’ ๐‘Ž)2 + โ‹ฏ ๐‘“โ€ฒโ€ฒ(๐‘ฅ) = 2๐‘2 + 3 โˆ™ 2๐‘3 (๐‘ฅ โˆ’ ๐‘Ž) + 4 โˆ™ 3(๐‘ฅ โˆ’ ๐‘Ž)2 โˆ™โˆ™โˆ™ ๐‘“โ€ฒโ€ฒโ€ฒ(๐‘ฅ) = 3 โˆ™ 2๐‘3 + 4 โˆ™ 3 โˆ™ 2(๐‘ฅ โˆ’ ๐‘Ž) + 5 โˆ™ 4 โˆ™ 3(๐‘ฅ โˆ’ ๐‘Ž)2 โˆ™โˆ™โˆ™

๐‘“ (๐‘›) (๐‘Ž) ๐‘“(๐‘Ž) = ๐‘0 ๐‘“โ€ฒ(๐‘Ž) = ๐‘1 ๐‘“โ€ฒโ€ฒ(๐‘Ž) = 2๐‘2 ๐‘“โ€ฒโ€ฒโ€ฒ(๐‘Ž) = 3 โˆ™ 2๐‘3

๐‘“ (๐‘›) (๐‘ฅ) = ๐‘›(๐‘› โˆ’ 1) โˆ™โˆ™โˆ™ 3 โˆ™ 2 โˆ™ 1๐‘๐‘› + (๐‘› + 1)๐‘›(๐‘› โˆ’ 1) โ‹ฏ 2๐‘๐‘›+1 (๐‘ฅ โˆ’ ๐‘Ž)

๐‘“ (๐‘›) (๐‘Ž) = ๐‘›! ๐‘๐‘›

๐‘Ž)2

Taylorโ€™s theorem If f (x) has derivatives of all orders in an open interval I containing a, then for each x in I, โˆž

๐‘“(๐‘ฅ) = โˆ‘ ๐‘›=0 ๐‘›

๐‘“ (๐‘›) (๐‘Ž) ๐‘“ (๐‘›) (๐‘Ž) ๐‘“ (๐‘›+1) (๐‘Ž) (๐‘ฅ โˆ’ ๐‘Ž)๐‘› = ๐‘“(๐‘Ž) + ๐‘“ โ€ฒ (๐‘Ž)(๐‘ฅ โˆ’ ๐‘Ž) + โ‹ฏ + (๐‘ฅ โˆ’ ๐‘Ž)๐‘› + (๐‘ฅ โˆ’ ๐‘Ž)๐‘›+1 + โ‹ฏ (๐‘› + 1)! ๐‘›! ๐‘›! โˆž

= โˆ‘ ๐‘˜=0

๐‘“ (๐‘˜) (๐‘Ž) ๐‘“ (๐‘˜) (๐‘Ž) (๐‘ฅ โˆ’ ๐‘Ž)๐‘˜ + โˆ‘ (๐‘ฅ โˆ’ ๐‘Ž)๐‘˜ ๐‘˜! ๐‘˜! ๐‘˜=๐‘›+1

convention for the sake of algebra: 0! = 1 = ๐‘‡๐‘› + ๐‘…๐‘› ๐‘›

๐‘‡๐‘› = โˆ‘ ๐‘˜=0

๐‘…๐‘› (๐‘ฅ) =

๐‘“ (๐‘˜) (๐‘Ž) (๐‘ฅ โˆ’ ๐‘Ž)๐‘˜ ๐‘๐‘œ๐‘™๐‘ฆ๐‘›๐‘œ๐‘š๐‘–๐‘Ž๐‘™ ๐‘œ๐‘“ ๐‘›๐‘กโ„Ž ๐‘œ๐‘Ÿ๐‘‘๐‘’๐‘Ÿ ๐‘˜! ๐‘“ (๐‘›+1) (๐‘ง) (๐‘ฅ โˆ’ ๐‘Ž)๐‘›+1 ๐‘–๐‘  ๐‘Ÿ๐‘’๐‘š๐‘Ž๐‘–๐‘›๐‘‘๐‘’๐‘Ÿ ๐‘…๐‘› (๐‘› + 1)!

Taylorโ€™s theorem says that there exists some value ๐‘ง between ๐‘Ž and ๐‘ฅ for which: โˆž

โˆ‘ ๐‘˜=๐‘›+1

๐‘“ (๐‘˜) (๐‘Ž) ๐‘“ (๐‘›+1) (๐‘ง) (๐‘ฅ โˆ’ ๐‘Ž)๐‘˜ can be replaced by ๐‘…๐‘› (๐‘ฅ) = (๐‘ฅ โˆ’ ๐‘Ž)๐‘›+1 ๐‘˜! (๐‘› + 1)!

2

Approximating function by a polynomial function So we are good to go. We can find value of ๐’‡(๐’™) around ๐’‚ by calculating ๐‘‡๐‘› , and then adding ๐‘…๐‘› . Instead of adding infinite number of terms (how in the world???), we have finite number of terms. Beautiful. A little problem: We know z exists, BUT we donโ€™t know how to find z . Thatโ€™s why we use approximation: By approximating ๐’‡(๐’™) with ๐‘‡๐‘› we neglect ๐‘…๐‘› . We can do it only if ๐‘…๐‘› is very small compared to ๐‘‡๐‘› . So if we find maximum possible value for ๐‘…๐‘› , and that value is small compared to ๐‘‡๐‘› , we found good approximation: ๐‘› ๐‘“ (๐‘˜) (๐‘Ž) (๐‘ฅ โˆ’ ๐‘Ž)๐‘˜ ๐‘“(๐‘ฅ) โ‰ˆ โˆ‘ ๐‘˜! ๐‘˜=0

error is remainder ๐‘…๐‘› (๐‘ฅ) =

๐‘“ (๐‘›+1) (๐‘ง) (๐‘ฅ โˆ’ ๐‘Ž)๐‘›+1 (๐‘› + 1)!

๐‘ง is the value between ๐‘Ž and ๐‘ฅ , that yields maximum ๐‘…๐‘›

A Maclaurin series is a Taylor series expansion of a function about 0

for n = 0 ๐‘“โ€ฒ(๐‘ง) =

๐‘“(๐‘ฅ) = ๐‘“(๐‘Ž) + ๐‘“โ€ฒ(๐‘ง)(๐‘ฅ โˆ’ ๐‘Ž)

๐‘“(๐‘ฅ) โˆ’ ๐‘“(๐‘Ž) โ†’ ๐‘€๐ธ๐ด๐‘ ๐‘ฃ๐‘Ž๐‘™๐‘ข๐‘’ ๐‘กโ„Ž๐‘’๐‘œ๐‘Ÿ๐‘’๐‘š ๐‘ฅโˆ’๐‘Ž

Problems: โ€ข For what values of x can we expect a Taylor series to represent f (x)?โ†’ ๐‘Ÿ๐‘Ž๐‘‘๐‘–๐‘ข๐‘  ๐‘œ๐‘“ ๐‘๐‘œ๐‘›๐‘ฃ๐‘’๐‘Ÿ๐‘”๐‘’๐‘›๐‘๐‘’ โ€ข How accurately do Taylor polynomials approximate the f (x)? โ†’ magnitude of the error ๐‘…๐‘›

example 1: Find Taylorโ€™s series for sin x centered at a = 0 (McLaurin series). ๐‘“(๐‘ฅ) = ๐‘ ๐‘–๐‘› ๐‘ฅ ๐‘“ โ€ฒ (๐‘ฅ) = ๐‘๐‘œ๐‘  ๐‘ฅ ๐‘“โ€ฒโ€ฒ(๐‘ฅ) = โˆ’๐‘ ๐‘–๐‘› ๐‘ฅ ๐‘“ โ€ฒโ€ฒโ€ฒ (๐‘ฅ) = โˆ’ cos ๐‘ฅ ๐‘“ (4) (๐‘ฅ) = sin ๐‘ฅ ๐‘กโ„Ž๐‘–๐‘  ๐‘๐‘Ž๐‘ก๐‘’๐‘Ÿ๐‘Ÿ๐‘› ๐‘ค๐‘–๐‘™๐‘™ ๐‘Ÿ๐‘’๐‘๐‘’๐‘Ž๐‘ก โˆž

๐‘“(๐‘ฅ) = โˆ‘ ๐‘›=0

๐‘“(0) = 0 ๐‘“โ€ฒ(1) = 1 ๐‘“ โ€ฒโ€ฒ (1) = 0 ๐‘“ โ€ฒโ€ฒโ€ฒ (1) = โˆ’1 ๐‘“ (4) (1) = 0

๐‘“ (๐‘›) (๐‘Ž) โˆ’1 3 (๐‘ฅ โˆ’ ๐‘Ž)๐‘› = 0 + 1๐‘ฅ + 0๐‘ฅ 2 + ๐‘ฅ + 0๐‘ฅ 4 + โ‹ฏ ๐‘›! 3! โˆž

=๐‘ฅโˆ’

๐‘ฅ3 ๐‘ฅ5 ๐‘ฅ7 (โˆ’1)๐‘› ๐‘ฅ 2๐‘›+1 + โˆ’ +โ‹ฏ= โˆ‘ 3! 5! 7! (2๐‘› + 1)! ๐‘›=0

Signs alternate and the denominators get very big; factorials grow very fast. Ratio test: ๐‘ฅ 2๐‘›+3 (2๐‘› + 1)! 1 lim | โˆ™ | = |๐‘ฅ 2 | lim | | = |๐‘ฅ 2 | โˆ™ 0 2๐‘›+1 ๐‘›โ†’โˆž (2๐‘› + 3)! ๐‘›โ†’โˆž (2๐‘› + 3)(2๐‘› + 2) ๐‘ฅ This converges for any value of x. The radius of convergence is infinity.

3 example 2: Find fifth order Taylorโ€™s approximation for f(x) = ln x centered at a = 1. ๐‘“(๐‘ฅ) = ln ๐‘ฅ ๐‘“ โ€ฒ (๐‘ฅ) = 1/ ๐‘ฅ ๐‘“โ€ฒโ€ฒ(๐‘ฅ) = โˆ’1/๐‘ฅ 2 ๐‘“ โ€ฒโ€ฒโ€ฒ (๐‘ฅ) = 2!โ„๐‘ฅ 3 ๐‘“ (4) (๐‘ฅ) = โˆ’ 3!โ„๐‘ฅ 4 ๐‘“ (5) (๐‘ฅ) = 4!โ„๐‘ฅ 5 ๐‘“ (๐‘›) (๐‘ฅ) =

๐‘“(1) = 0 ๐‘“โ€ฒ(1) = 1 ๐‘“ โ€ฒโ€ฒ (1) = โˆ’1 ๐‘“ โ€ฒโ€ฒโ€ฒ (1) = 2! ๐‘“ (4) (1) = โˆ’ 3! ๐‘“ (5) (1) = 4!

(โˆ’1)๐‘›+1 (๐‘› โˆ’ 1)! ๐‘ฅ๐‘›

โ†’

๐‘“ (๐‘›) (1) = (โˆ’1)๐‘›+1 (๐‘› โˆ’ 1)! ๐‘๐‘› =

โˆž

๐‘“ (๐‘›) (1) (โˆ’1)๐‘›+1 = ๐‘›! ๐‘›

โˆž

ln(๐‘ฅ) = โˆ‘ ๐‘›=0

(โˆ’1)๐‘›+1 ๐‘“ (๐‘›) (1) 1 1 1 (๐‘ฅ โˆ’ 1)๐‘› = โˆ‘ (๐‘ฅ โˆ’ 1)๐‘› = (๐‘ฅ โˆ’ 1) โˆ’ (๐‘ฅ โˆ’ 1)2 + (๐‘ฅ โˆ’ 1)3 โˆ’ (๐‘ฅ โˆ’ 1)4 + โ‹ฏ ๐’‡๐’๐’“ |๐’™ โˆ’ ๐Ÿ| < ๐Ÿ ๐‘›! ๐‘› 2 3 4 ๐‘›=1

๐ŸŽ