3.4 Hermite 3.5 Cubic Interpolation

1 Illustration. Consider to interpolate tanh( ) using Lagrange 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

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

β€’ 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 β€² β„Ž0𝑐𝑐0 β„Ž+0𝑐𝑐12 β„Ž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 interpolantπ‘Žπ‘Žthat 𝑏𝑏 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