<<

3.1 and Lagrange

1 Example. Daily Treasury Yield Curve Rates

Date 1 Mo 3 Mo 6 Mo 1 Yr 2 Yr 3 Yr 5 Yr 7 Yr 10 Yr 20 Yr 30 Yr 09/01/ 0.01 0.03 0.26 0.39 0.70 1.03 1.49 1.89 2.17 2.62 2.93 15

Suppose we want yield rate for a four-years maturity bond, what shall we do? Solution: Draw a smooth curve passing through these data points (interpolation).

Ref: http://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield 2 • Interpolation problem: Find a smooth function which interpolates (passes) the data ( , ) . 𝑃𝑃 𝑥𝑥 𝑁𝑁 𝑖𝑖 𝑖𝑖 𝑖𝑖=0 • Remark𝑥𝑥 𝑦𝑦 : In this class, we always assume that the data represent measured or computed values of 𝑁𝑁a underlying function , i.e., = ( ) 𝑦𝑦Thus𝑖𝑖 𝑖𝑖= 0 can be considered as an approximation to . 𝑓𝑓 𝑥𝑥 𝑦𝑦𝑖𝑖 𝑓𝑓 𝑥𝑥𝑖𝑖 𝑃𝑃 𝑥𝑥 𝑓𝑓 3 Polynomial Interpolation = + + + + are commonly used for interpolation.𝑛𝑛 2 𝑛𝑛 𝑛𝑛 2 1 0  Advantages𝑃𝑃 𝑥𝑥for using𝑎𝑎 polynomial:𝑥𝑥 ⋯ efficient,𝑎𝑎 𝑥𝑥 simple𝑎𝑎 𝑥𝑥 𝑎𝑎 mathematical operation such as differentiation and integration.

Theorem 3.1 Weierstrass Approximation theorem Suppose [ , ]. Then > 0, a polynomial : < , , . Remark: 𝑓𝑓 ∈ 𝐶𝐶 𝑎𝑎 𝑏𝑏 ∀𝜖𝜖 ∃ 𝑃𝑃 𝑥𝑥 𝑓𝑓 1.𝑥𝑥 The− 𝑃𝑃bound𝑥𝑥 is uniform,𝜖𝜖 ∀𝑥𝑥 ∈ i.e. 𝑎𝑎valid𝑏𝑏 for all in , . This means polynomials are good at approximating general functions. 2. The way to find is unknown. 𝑥𝑥 𝑎𝑎 𝑏𝑏

𝑃𝑃 𝑥𝑥 4 • Question: Can Taylor polynomial be used here? • Taylor expansion is accurate in the neighborhood of one point. We need to the (interpolating) polynomial to pass many points.

• Example. Taylor polynomial approximation of for [0,3] 𝑥𝑥 𝑒𝑒 𝑥𝑥 ∈

5 • Example. Taylor polynomial approximation of for [0.5,5]. Taylor polynomials of different degrees1 are expanded at = 1 𝑥𝑥 𝑥𝑥 ∈ 𝑥𝑥0

6 -degree Lagrange Interpolating Polynomial Goal: construct a polynomial of degree 2 passing 3 data points𝟐𝟐𝟐𝟐𝟐𝟐 , , , , , . Step 1: construct a set of basis polynomials , , = 0,1,2 satisfying𝑥𝑥0 𝑦𝑦0 𝑥𝑥1 𝑦𝑦1 𝑥𝑥2 𝑦𝑦2 1, when = 𝐿𝐿2 𝑘𝑘 𝑥𝑥 𝑘𝑘 = , 0, when 𝑗𝑗 𝑘𝑘 𝐿𝐿These2 𝑘𝑘 𝑥𝑥 𝑗𝑗polynomials� are: 𝑗𝑗 ≠( 𝑘𝑘 )( ) , = , ( 1)( 2 ) (𝑥𝑥 − 𝑥𝑥 )(𝑥𝑥 − 𝑥𝑥 ) 𝐿𝐿2 0 𝑥𝑥 , = 𝑥𝑥0 − 𝑥𝑥1 𝑥𝑥0 − 𝑥𝑥2 , ( 0)( 2 ) 2 1 (𝑥𝑥 − 𝑥𝑥 )(𝑥𝑥 − 𝑥𝑥 ) 𝐿𝐿 𝑥𝑥 = 1 0 1 2 , (𝑥𝑥 − 𝑥𝑥 )(𝑥𝑥 − 𝑥𝑥 ) 𝑥𝑥 − 𝑥𝑥0 𝑥𝑥 − 𝑥𝑥1 7 𝐿𝐿2 2 𝑥𝑥 𝑥𝑥2 − 𝑥𝑥0 𝑥𝑥2 − 𝑥𝑥1 Step 2: form the 2nd-degree Lagrange interpolating polynomial :

𝑃𝑃 𝑥𝑥 = , + , + ,

𝑃𝑃 𝑥𝑥 𝑦𝑦0𝐿𝐿2 0 𝑥𝑥 𝑦𝑦1𝐿𝐿2 1 𝑥𝑥 𝑦𝑦2𝐿𝐿2 2 𝑥𝑥

8 Exercise 3.1.2(a) Use nodes = 1, = 1.25, = 1.6 to find 2nd Lagrange interpolating 0 1 polynomial for =𝑥𝑥sin 𝑥𝑥. And use 2 𝑥𝑥to approximate 1.4 . 𝑃𝑃 𝑥𝑥 𝑓𝑓 𝑥𝑥 𝜋𝜋𝜋𝜋 𝑃𝑃 𝑥𝑥 𝑓𝑓

9 -degree Interpolating Polynomial through + Points

Constructing𝒏𝒏 a Lagrange interpolating polynomial𝒏𝒏 𝟏𝟏 passing through the points ( , ), , , 𝑃𝑃 𝑥𝑥 , , … , ( , ). 𝑥𝑥0 𝑓𝑓 𝑥𝑥0 𝑥𝑥1 𝑓𝑓 𝑥𝑥1 = 1.𝑥𝑥2Define𝑓𝑓 𝑥𝑥2 Lagrange𝑥𝑥𝑛𝑛 𝑓𝑓 𝑥𝑥basis𝑛𝑛 functions , = … , 𝑛𝑛 𝑘𝑘 𝑥𝑥−𝑥𝑥𝑖𝑖 𝑥𝑥−𝑥𝑥0 𝑥𝑥−𝑥𝑥𝑘𝑘−1𝐿𝐿 𝑥𝑥 𝑛𝑛 … for = 0,1 … . ∏𝑖𝑖=0 𝑖𝑖≠𝑘𝑘 𝑥𝑥𝑘𝑘−𝑥𝑥𝑖𝑖 𝑥𝑥𝑘𝑘−𝑥𝑥0 𝑥𝑥𝑘𝑘−𝑥𝑥𝑘𝑘−1 � 𝑥𝑥−𝑥𝑥𝑘𝑘+1 𝑥𝑥−𝑥𝑥𝑛𝑛 = 1; = 0, Remark:𝑥𝑥𝑘𝑘−𝑥𝑥𝑘𝑘+1 , 𝑥𝑥𝑘𝑘−𝑥𝑥𝑛𝑛 , 𝑘𝑘 𝑛𝑛 2. = + + 𝐿𝐿𝑛𝑛 𝑘𝑘 𝑥𝑥𝑘𝑘 , 𝐿𝐿𝑛𝑛 𝑘𝑘 𝑥𝑥𝑖𝑖 ∀𝑖𝑖 ≠ 𝑘𝑘 , . 0 𝑛𝑛 0 𝑛𝑛 𝑛𝑛 𝑛𝑛 𝑃𝑃 𝑥𝑥 𝑓𝑓 𝑥𝑥 𝐿𝐿 𝑥𝑥 ⋯ 𝑓𝑓 𝑥𝑥 𝐿𝐿 𝑥𝑥 10 • , ( ) for points = , = 0, … , 6.

𝐿𝐿6 3 𝑥𝑥 𝑥𝑥𝑖𝑖 𝑖𝑖 𝑖𝑖

11 • Theorem 3.2 If , … , are + 1distinct numbers (called nodes) and is a function whose 0 𝑛𝑛 values are given𝑥𝑥 at these𝑥𝑥 numbers,𝑛𝑛 then a unique polynomial ( ) of degree at𝑓𝑓 most exists with = , for each = 0, 1, … . 𝑃𝑃 𝑥𝑥 𝒏𝒏 = , + + , . 𝑃𝑃 𝑥𝑥𝑘𝑘 𝑓𝑓 𝑥𝑥𝑘𝑘 𝑘𝑘 𝑛𝑛 𝑃𝑃Where𝑥𝑥 𝑓𝑓 , 𝑥𝑥0 𝐿𝐿𝑛𝑛=0 𝑥𝑥 , ⋯ 𝑓𝑓 𝑥𝑥. 𝑛𝑛 𝐿𝐿𝑛𝑛 𝑛𝑛 𝑥𝑥 𝑛𝑛 𝑥𝑥−𝑥𝑥𝑖𝑖 𝐿𝐿𝑛𝑛 𝑘𝑘 𝑥𝑥 ∏𝑖𝑖=0 𝑖𝑖≠𝑘𝑘 𝑥𝑥𝑘𝑘−𝑥𝑥𝑖𝑖

12 Error Bound for the Lagrange Interpolating Polynomial Theorem 3.3 Suppose , … , are distinct numbers in the interval [ , ] and , . 0 𝑛𝑛 Then for each in [ , 𝑥𝑥], a number𝑥𝑥 ( )𝑛𝑛(generally+1 unknown) between , …𝑎𝑎, 𝑏𝑏 , and 𝑓𝑓hence∈ 𝐶𝐶 in (𝑎𝑎, 𝑏𝑏), exists with 𝑥𝑥 = 𝑎𝑎 𝑏𝑏 + 𝜉𝜉 𝑥𝑥 𝑥𝑥0 𝑥𝑥𝑛𝑛 𝑎𝑎 𝑏𝑏 𝑓𝑓 𝑥𝑥 𝑃𝑃 𝑥𝑥 … . 𝑛𝑛+1+ 1 ! 𝑓𝑓 𝜉𝜉 𝑥𝑥 Where is the Lagrange𝑥𝑥 − 𝑥𝑥0 𝑥𝑥interpolating− 𝑥𝑥1 𝑥𝑥 − 𝑥𝑥𝑛𝑛 polynomial.𝑛𝑛 𝑃𝑃 𝑥𝑥

13 • Remark: 1. Applying the error term may be difficult. is generally unknown. 2. … is oscillatory. 𝜉𝜉 𝑥𝑥 𝑥𝑥 − 𝑥𝑥0 𝑥𝑥 − 𝑥𝑥1 𝑥𝑥 − 𝑥𝑥𝑛𝑛

Graph of 0 1 2 3 4 Remark: In general, is small when is close to the center of , . 𝑥𝑥 − 𝑥𝑥 − 𝑥𝑥 − 𝑥𝑥 − 𝑥𝑥 − 𝑓𝑓 𝑥𝑥 − 𝑝𝑝 𝑥𝑥 𝑥𝑥 𝑥𝑥0 𝑥𝑥𝑛𝑛 3. The error formula is important as they are used for numerical differentiation and integration. 14 Example 3. 2nd for = on [2, 4] using nodes = 2, = 2.75, = 1 𝑓𝑓 𝑥𝑥 4 = + . 𝑥𝑥 is 𝑥𝑥0 Determine𝑥𝑥1 the𝑥𝑥2 error form for1 2 ,35 and maximum49 error when 22 88 44 polynomial𝑃𝑃 𝑥𝑥 is used𝑥𝑥 − to approximate𝑥𝑥 for 2,4 . 𝑃𝑃 𝑥𝑥 𝑓𝑓 𝑥𝑥 𝑥𝑥 ∈

15 Exercise 3.1.6(a). Use appropriate Lagrange polynomials of degree 2 to approximate (0.43) if 0 = 1, 0.25 = 1.64872, 0.5 = 2.71828, 0.75 = 4.48169. 𝑓𝑓 𝑓𝑓 𝑓𝑓 𝑓𝑓 𝑓𝑓

16 Example 4 Suppose a table is to be prepared for = , [0,1]. Assume the number of decimal places𝑥𝑥 to be given per entry is 8 and𝑓𝑓 𝑥𝑥 that𝑒𝑒 the𝑥𝑥 difference∈ between adjacent - values, the step size is . What step size𝑑𝑑 ≥will ensure that gives an 𝑥𝑥 absolute error of at mostℎ 10 for all inℎ 0,1 . −6 𝑥𝑥

17