Professional Documents
Culture Documents
Numeric 5
Numeric 5
x x0 x1 x2 ... xn
f (x) f (x0 ) f (x1 ) f (x2 ) ... f (xn )
Hermite Polynomials
Remark
1. H(x) and f (x) agree not only function values but also 1st derivative values
at x0 , x1 , ..., xn .
2. The degree of H(x) is at most 2n + 1 because the number of conditions
to be satisfied is 2n + 2 and a polynomial of degree 2n + 1 has 2n + 2
coefficients that can be used to satisfy these conditions.
where
Hn,j (x) = 1 − 2(x − xj )L0n,j (xj ) L2n,j (x)
and
a
H n,j (x) = (x − xj )L2n,j (x)
Here Ln,j (x) denoting the jth Lagrange coefficient polynomial of degree n.
1
Moreover, if f ∈ C 2n+2 [a, b], then
(x − x0 )2 ...(x − xn )2 (2n+2)
f (x) = H2n+1 (x) + f (ξ (x))
(2n + 2)!
Remark
(x−x0 )2 ...(x−xn )2 (2n+2)
1. (2n+2)! f (ξ (x)) is the error term.
x 0 0.5 1
f (x) 0.6 0.4 0.2
f 0 (x) -0.5 -0.6 -1
This gives
(x − x1 )(x − x2 ) (x − 0.5)(x − 1)
L2,0 (x) = = = 2x2 − 3x + 1
(x0 − x1 )(x0 − x2 ) (0 − 0.5)(0 − 1)
L02,0 (x) = 4x − 3
(x − 0)(x − 1)
L2,1 (x) = = −4x2 + 4x
(0.5 − 0)(0.5 − 1)
L02,1 (x) = −8x + 4
(x − 0)(x − 0.5)
L2,2 (x) = = 2x2 − x
(1 − 0)(1 − 0.5)
L02,2 (x) = 4x − 1
2
a
The polynomials H2,j (x) and H 2,j (x) are then
2
H2,0 (x) = [1 − 2(x − 0)(−3)] 2x2 − 3x + 1
2
= (6x + 1) 2x2 − 3x + 1
2
H2,1 (x) = [1 − 2(x − 0.5)(0)] −4x2 + 4x
2
= −4x2 + 4x
2
H2,2 (x) = [1 − 2(x − 1)(3)] 2x2 − x
2
= (−6x + 7) 2x2 − x
a 2
H 2,0 (x) = x 2x2 − 3x + 1
a 2
H 2,1 (x) = (x − 0.5) −4x2 + 4x
a 2
H 2,2 (x) = (x − 1) 2x2 − x
Hence
and
3
Since n = 1 (2n + 1 = 3) , we seek
H3 (x) = a0 + a1 x + a2 x2 + a3 x3
H3 (0) = f (0) = 0 ⇒ a0 = 0
1 1 1 1 1
H3 = f( ) = 1 ⇒ a0 + a1 + a2 + a3 = 1
2 2 2 4 8
H30 (0) = f 0 (0) = π ⇒ a1 = π
1 1 3
H30 = f 0( ) = 0 ⇒ a1 + a2 + a3 =0
2 2 4
The above system can be solved and the unknown coefficients can be evalu-
ated as
a0 = 0, a1 = π, a2 = 12 − 4π, a3 = 4π − 16
Therefore,
H3 (x) = πx + (12 − 4π) x2 + (4π − 16) x3
This gives
1 1 π (12 − 4π) (4π − 16)
f ( ) ≈ H3 = + + ≈ 0.6963
4 4 4 16 64
Error analysis:
where
(x − x0 )2 (x − x1 )2 (4)
1
R(x) = f (ξ (x)) , ξ (x) ∈ 0,
(2n + 2)! 2
f (4) (ξ (x)) 2 1
= x (x − )2
24 2
π 4 sin(πξ) 2 1
= x (x − )2
24 2
4
π4
1 π sin(πξ) 1 1
R( ) = ≤ ≈ 0.0159
4 24 42 42 24.16.16
Note:
4
1
f ( ) − H3 1 = R( 1 ) ≤ 0.0159
4 4 4
1 1 1
H3 − 0.0159 ≤ f ( ) ≤ H3 + 0.0159
4 4 4
1
0.6963 − 0.0159 ≤ f ( ) ≤ 0.6963 + 0.0159
4
π
0.6804 ≤ sin ≤ 0.7122
4
2 SPLINE INTERPOLATION
5
Splıne of Degree k
NOTE
The xi ’s are the knots and are assumed to be arranged in ascending order.
6
In this formula,
2 3
Si (x) = ai + bi (x − xi ) + ci (x − xi ) + di (x − xi ) , i = 0, 1, ..., n − 1
denotes the cubic polynomial that will be used on the subinterval [xi , xi+1 ].
The interpolation conditions are
S(xi ) = yi , 0≤i≤n (2)
The continuity conditions are written as
lim S (k) (xi ) = lim+ S (k) (xi ), k = 0, 1, 2 (3)
x→x−
i x→xi
There are n+1 knots and hence n subintervals. On each of these subintervals,
we shall have a different cubic polynomial. Since a cubic polynomial has four
coefficients, a total of 4n coefficients are available. we have specified that within
each interval the interpolating polynomial must go through two points, which
gives 2n conditions.. The first and second derivatives must be continuous at the
n − 1 interior points, for 2(n − 1) more conditions.
It turns out that two more conditions must be imposed.
00
1. If the choice that we make for these two extra conditions is S (x0 ) =
00
S (xn ) = 0, the resulting spline function is then termed a natural cubic
spline.
0
2. If the choice that we make for these two extra conditions is S (x0 ) =
0
f 0 (x0 ) and S (xn ) = f 0 (xn ) , the resulting spline function is then termed
a clamped cubic spline.
Example Construct a natural cubic spline that passes through the points
(1, 2), (2, 3), and (3, 5).
x 1 2 3
y 2 3 5
Four conditions come from the fact that the splines must agree with the data
at the nodes. Hence
S0 (1) = 2 =⇒ a0 = 2
S0 (2) = 3 =⇒ a0 + b0 + c0 + d0 = 3
S1 (2) = 3 =⇒ a1 = 3
S1 (3) = 5 =⇒ a1 + b1 + c1 + d1 = 5
7
Taking the first derivatives, we obtain
S000 (1) = 0 =⇒ c0 = 0
S100 (3) = 0 =⇒ 2c1 + 6d1 = 0
S0 (x) = 2 + 34 (x − 1) + 14 (x − 1)3 ,
1≤x≤2
S (x) =
S1 (x) = 3 + 23 (x − 2) + 43 (x − 2)2 − 41 (x − 2)3 , 2 ≤ x ≤ 3
Solution The splines must agree with the data at the nodes. Hence
S0 (2) = S1 (2) =⇒ a = 4
8
S00 (x) = 3 + 4(x − 1) − 3(x − 1)2 ,
1≤x≤2
S 0 (x) =
S10 (x) = b + 2c(x − 2) + 3d(x − 2)2 , 2≤x≤3
From the continuity of S 0 , we have