3.4 Hermite Interpolation
3.5 Cubic Spline Interpolation
1
Hermite Polynomial
Definition. Suppose ∈ 1[, ]. Let 0, … , be
distinct numbers in [, ], the Hermite polynomial
() approximating is that:
1. = , for = 0, … ,
2. = , for = 0, … ,
Remark: () and () agree not only function values but
also 1st derivative values at , = 0, … , .
2
Theorem. If ∈ 1 , and 0, … , ∈ , distinct
numbers, the Hermite polynomial is:
2+1 = ,() + ′ ,()
=0 =0
Where , = [1 − 2( − )′,()]2,()
, = − 2,
Moreover, if ∈ 2+2 , , then
− 0 2 … − 2
= 2+1 + 2 + 2 ! 2+2 (())
for some ∈ , .
Remark:
1. 2+1 is a polynomial of degree at most 2 + 1.
2. ,() is jth Lagrange basis polynomial of degree .
−0 2… − 2
3. 2+2 ! 2+2 (()) is the error term.
3
3rd Degree Hermite Polynomial
• Given distinct 0, 1 and values of and ′ at these
numbers.
2
3 = 1 + 2 − 0 1 − 0
1 − 0 1 − 0
+ − 0 1 − 2 0
1 − 0
′
+ 1 + 2 1 − 0 − 2 1
1 − 0 0 − 1
+ − 1 0 − 2 1
0 − 1
′
4
Hermite Polynomial by Divided Differences
DSuepfipnoese0,…0, …, 2, +1abnyd , ′ are given at these numbers.
2 = 2+1 = , for = 0, … ,
Construct divided difference table, but use
′ 0 , ′ 1 , . . , ′
to set the following undefined divided difference:
0, 1 , 2, 3 , … , 2, 2+1 .
The Hermite polynomial is
2+1
2+1 = 0 + 0, … , − 0 … ( − −1)
=1
5
Divided Difference Notation for Hermite
Interpolation
• Divided difference notation:
3 + ′ 0 − 0
= 0
+ 0, 0, 1 − 0 2
+ [0, 0, 1, 1] − 0 2( − 1)
6
Problems with High Order Polynomial Interpolation
• 21 equal-spaced numbers to interpolate
1
= 1+162 . The interpolating polynomial
oscillates between interpolation points.
7
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.
• Challenge: If ′() are not known, can we still
generate interpolating polynomial with
continuous derivatives?
8
Definition: Given a function on [, ] and nodes = 0 <
⋯ < = , a cubic spline interpolant for satisfies:
(a) () is a cubic polynomial () on [, +1], ∀ =
0,1, … , − 1.
(b) = () and +1 = +1 , ∀ = 0,1, … , −
1.
(c) +1 = +1 +1 , ∀ = 0,1, … , − 2.
(d) ′ +1 = ′+1 +1 , ∀ = 0,1, … , − 2.
(e) ′′ +1 = ′′+1 +1 , ∀ = 0,1, … , − 2.
(f) One of the following boundary conditions:
(i) ′′ 0 = ′′ = 0 (called free or natural boundary)
(ii) ′ 0 = ′(0) and ′ = ′() (called clamped
boundary)
9
Things to match at interior point +1:
• The spline segment () is on , +1 .
• The spline segment +1() is on +1, +2 .
• Their function values: +1 = +1 +1 =
+1
• First derivative values: ′ +1 = ′+1 +1
• Second derivative values: ′′ +1 = ′′+1 +1
10
Building Cubic Splines
• Define:
= + − + ( − )2+( − )3
and ℎ = +1 − , ∀ = 0,1, … , − 1.
Solve for coefficients , , , by:
1. = = ()
2. +1 +1 = +1 = + ℎ + (ℎ)2+(ℎ)3
3. ′ = , also +1 = + 2ℎ + 3(ℎ)2
4. ′′ = 2, also +1 = + 3ℎ
5. Natural or clamped boundary conditions
11
Solving the Resulting Equations
∀ = 1, … , − 1
ℎ−1−1 + 2 ℎ−1 + ℎ + ℎ+1
3 3
= ℎ +1 − − ℎ−1 − −1
Remark: (n-1) equations for (n+1) unknowns {}=0.
Once compute , we then compute:
= +1− − ℎ 2++1
ℎ 3
= +1 −
3ℎ
12
Completing the System
• Natural boundary condition:
1. 0 = ′′0 0 = 20 → 0 = 0
2. 0 = ′′ = 2 → = 0
• Clamped boundary condition:
a) ′0 0 = 0 = ′(0)
b) ′−1 = = −1 + ℎ−1(−1 + ) = ′()
Remark: a) and b) gives additional equations:
2+ℎℎ−011==ℎ3−0 (ℎ301
2ℎ00 − 0) − 3′(0)
ℎ−1−1 + − −1 + 3′()
13
Error Bound
If ∈ 4[, ], let = max |4()|. If is the
≤≤
unique clamped cubic spline interpolant to with
respect to the nodes: = 0 < ⋯ < = , then
with
ℎ = max +1 −
0≤≤−1
max | − ()| ≤ 5ℎ4 .
384
≤≤
14