3.4 Hermite Interpolation 3.5 Cubic Spline Interpolation
Total Page:16
File Type:pdf, Size:1020Kb
3.4 Hermite Interpolation 3.5 Cubic Spline Interpolation 1 Illustration. Consider to interpolate tanh( ) using Lagrange polynomial and nodes = 1.5, = 0, = 1.5. 0 − 1 2 Now interpolate tanh( ) using nodes = 1.5, = 0, = 1.5. Moreover, Let 1st 0 1 derivative of interpolating− 2 polynomial agree with derivative of tanh( ) at these nodes. Remark:This is called Hermite interpolating polynomial. 2 Hermite Polynomial Definition. Suppose [ , ]. Let , … , be distinct numbers in [ , ], 1the Hermite polynomial 0 ( ) approximating is∈ that: 1. = , for = 0, … , 2. = , for = 0, … , Remark: ( ) and ( ) agree not only function values but also 1st derivative values at , = 0, … , . 3 Osculating Polynomials Definition 3.8 Let , … , be distinct numbers in , and for = 0, … , , let be a nonnegative integer. 0 Suppose that , , where = max . The osculating polynomial approximating is the polynomial ∈ 0≤≤ ( ) of least degree such that = for each = 0, … , and k= 0, … , . Remark: the degree of ( ) is at most = + . ∑=0 4 Theorem 3.9 If , and , … , , distinct numbers, the Hermite1 polynomial of degree at most + 1 is: ∈ 0 ∈ = , ( ) + 2, ( ) 2+1 Where � � ′ � =0 =0 , = [1 2( ) , ( )] , ( ) 2 , = ′ − − , Moreover, if , , then 2 � − 2+2 … = ∈ + ( ( )) 2 + 2 ! 2 − 0 − 2+2 for some 2+1 , . Remark: 2 1. is a polynomial∈ of degree at most + 1. 2. , ( ) is jth Lagrange basis polynomial of degree . 2+1 … 2 3. 2 2 ( ( )) is the error term. −0 −! 2+2 2+2 5 Remark: 1. When : , = 0; , = 0. 2. When = : ≠ � , = 1 2 , , = 1 = ′ = 0 2 , − −, � 2 � = −( ). 3. ⟹ , 2+=1 , 2 , , + 1 2 , 2 , ′ ′ ′ ′ When : − , = 0; When− =− : , = 0. ′ ′ 4. ⟹ , =≠ , + 2 , ( ) , :2 = 0; = : ′ = 1. �′When , −When , 6 ⟹ ≠ �′ �′ Example 3.4.1 Use Hermite polynomial that agrees with the data in the table to find an approximation of 1.5 ( ) ( ) 0 1.3 0.6200860 0.5220232 1 1.6 0.4554022 0.5698959′ 2 1.9 0.2818186 −0.5811571 − − 7 3rd Degree Hermite Polynomial • Given distinct , and values of and at these numbers. 0 1 ′ 3 = 1 + 2 2 0 1 − − 0 1 0 1 0 + − 2 − 1 ′ 0 − 0 − 1 0 + 1 + 2 − 2 1 0 − − 1 1 0 0 1 + − 2 − 0 − ′ − 1 1 0 − 1 8 Hermite Polynomial by Divided Differences Suppose , … , and , are given at these numbers. Define , … , by 0 = =′ , for = 0, … , 0 2+1 2 2+1 Construct divided difference table, but use , , . , to set the following undefined′ ′ divided difference:′ , ,0 , 1, … , , . Namely, , = , , = , … 0 1 2 3 2 2+1 ′ , = ′ . 0 1 0 2 3 1 The Hermite polynomial is ′ 2 2+1 = + 2+1 , … , … ( ) 9 2+1 0 � 0 − 0 − −1 =1 Example 3.4.2 Use divided difference method to determine the Hermite polynomial that agrees with the data in the table to find an approximation of 1.5 ( ) ( ) 0 1.3 0.6200860 0.5220232 1 1.6 0.4554022 0.5698959′ 2 1.9 0.2818186 −0.5811571 − − 10 Divided Difference Notation for Hermite Interpolation • Divided difference notation for Hermite polynomial interpolating 2 nodes: , . = + + , 0, 1 3 + [ , , ′ , ] ( ) 2 0 0 0 0 0 1 0 − 2 − 0 0 1 1 − 0 − 1 11 Problems with High Order Polynomial Interpolation • 21 equal-spaced numbers to interpolate = . The interpolating polynomial 1 oscillates between2 interpolation points. 1+25 12 3.5 Cubic Splines • Idea: Use piecewise polynomial interpolation, i.e, divide the interval into smaller sub-intervals, and construct different low degree polynomial approximations (with small oscillations) on the sub- intervals. Example. Piecewise-linear interpolation 13 • Challenge: If ( ) are not known, can we still generate interpolating polynomial with continuous derivatives? ′ • Spline: A spline consists of a long strip of wood (a lath) fixed in position at a number of points. The lath will take the shape which minimizes the energy required for bending it between the fixed points, and thus adopt the smoothest possible shape. 14 • In mathematics, a spline is a function that is piecewise-defined by polynomial functions, and which possesses a high degree of smoothness at the places where the polynomial pieces connect. • Example. Irwin-Hall distribution. Nodes are -2, -1, 0, 1, 2. 1 + 2 2 1 4 1 3 = 3 6 + 4 − ≤ 1≤ − 1 4 1 3 2 2 − 1− ≤ 2≤ 4 3 Notice: 1 =− , 1 = , ≤ 1≤ = , 1 = . ′ 3 ′ 3 ′′ 6 ′′ 6 − 4 − 4 − 4 4 15 • Piecewise-polynomial approximation using cubic polynomials between each successive pair of nodes is called cubic spline interpolation. Definition 3.10 Given a function on [ , ] and nodes = < < = , a cubic spline interpolant for satisfies: (a) ( ) is a cubic polynomial ( ) on [ , ] with: 0 ⋯ = + + + +1 = 0,1, … , 1.2 3 − − − (b) = ( ) and = , = 0,1, … , 1. ∀ − = , = 0,1, … , 2. (c) +1 +1 Remark: (c) is derived from (b). ∀ − +1 +1 +1 (d) = ∀, = 0,1, …, − 2. (e) ′ = ′ , = 0,1, … , 2. +1 +1 +1 ∀ − (f) One′′ of the following′′ boundary conditions: +1 +1 +1 (i) = =0 (called∀ free or natural − boundary) (ii) ′′ = (′′ ) and = ( ) (called clamped boundary) 0 16 ′ ′ 0 ′ 0 ′ The spline segment ( ) is on , . The spline segment ( ) is on , . Things to match at +1 interior point : +1 +1 +2 • Their function values: = = +1 +1 +1 +1 • First derivative values: = +1 • Second derivative values:′ =′ +1 +1 +1 ′′ ′′ 17 +1 +1 +1 Example 3.5.1 Construct a natural spline through (1,2), (2,3) and (3.5). 18 Building Cubic Splines • Define: = + + ( ) + ( ) and = , = 0,1, … , ( 1). 2 3 • Also define = ;− = −; = (− )/2. ℎ +1 − ∀ − From Definition 3.10: ′ ′′ 1) = = for =0,1, …, ( 1). 2) = = + + ( ) + ( ) − for = 0,1, … , ( 1). 2 3 +1 +1 +1 : = + +ℎ ( ℎ ) + ℎ( ) − 3) = = + 2 + 3 2 ( ) 3 , also−1 −1ℎ−1 −1 ℎ−1 −1 ℎ−1 ′ for = 0,1, … , ( 1). 2 +1 4) = , also = + 3 ℎ ℎ − ′′ for = 0,1, … , 1 . +1 5) Natural or clamped2 boundary conditions ℎ − 19 Solve , , , by substitution: 1. Solve Eq. 4) for = , and substitute into Eqs. 2) and 3) to +1 get: − 3ℎ 2. = + + 2 2 + ; (3.18) ℎ = + + . (3.19) +1 ℎ 3 +1 3. Solve for in Eq. (3.18) to get: +1 ℎ +1 = 2 + . (3.20) 1 ℎ Reduce the index by 1 to get: ℎ +1 − − 3 +1 = 2 + . 1 ℎ−1 4. Substitute−1 and into−1 Eq. (3.19):−1 ℎ−1 − − 3 + 2 + + = (3.21) −1 3 3 ℎ−1−1 ℎ−1 ℎ ℎ(+1 ) +1 =1,2, … , 1 . −1 for − − − 20 ℎ ℎ−1 − Solving the Resulting Equations = 1,2, … , ( 1) + 2 + + ∀ 3 − 3 ℎ=−1−1 ℎ−1 ℎ ℎ+1 (3.21) Remark: (n-1) equations+1 − for− (n+1) unknowns − −1 { } . Eq. ℎ ℎ−1 (3.21) is solved with boundary conditions. =0 • Once compute , we then compute: = (3.20) +1− ℎ 2++1 ℎ −and 3 = (3.17) for = 0,1,2, … , ( 1) +1− 21 3ℎ − Building Natural Cubic Spline • Natural boundary condition: 1. 0 = = 2 = 0 2. 0 = ′′ = 2 = 0 0 0 0 → 0 Step 1. Solve′′ Eq. (3.21) together with = 0 and → = 0 to obtain { } . 0 { } Step 2. Solve Eq. (3.20) =0to obtain . { }−1 Step 3. Solve Eq. (3.17) to obtain =0 . −1 =0 22 Building Clamped Cubic Spline • Clamped boundary condition: a) = = ( ) b) ′ = = + ( + ) = ( ) 0 0 0 ′ 0 Remark:′ a) and b) gives additional equations: −1 −1 ℎ−1 −1 ′ 2 + = 3 ( ) 3 3 ′ ℎ00 ℎ+012 ℎ0 1=− 0 − 0 + 3 ( ) ′ Stepℎ −11. Solve−1 Eq.ℎ− 1(3.21) − together − with−1 Eqs. (a)and (b) to ℎ−1 obtain { } . Step 2. Solve Eq. (3.20) to obtain { } . =0 Step 3. Solve Eq. (3.17) to obtain { }−1 . =0 −1 =0 23 Example 3.5.4 Let ( , ( )) = (0,1), ( , ( )) = (1, ), ( , ( )) = (2, ), 0 0 ( , ( )) = (3, ). And = , =2 . 1 1 2 2 Determine the clamped3 spline . ′ 3 3 3 3 ′ 0 24 Theorem 3.11 If is defined at the nodes: = < < = , then has a unique natural spline interpolant on the nodes; that is a spline interpolant0 ⋯ that satisfied the natural boundary conditions = 0, = 0. ′′ ′′ Theorem 3.12 If is defined at the nodes: = < < = and differentiable at and , then has a unique clamped spline interpolant on0 the⋯ nodes; that is a spline interpolantthat satisfied the clamped boundary conditions = ( ), = ( ). ′ ′ ′ ′ 25 Error Bound Theorem 3.13 If [ , ], let = max | ( )|. If is the4 unique clamped cubic ∈ spline interpolant4 to with respect to the nodes: ≤≤ = < < = , then with = max 0 ⋯ +1 maxℎ | 0≤≤−1 ( )| − . 4 5ℎ ≤≤ − ≤ 384 26.