Professional Documents
Culture Documents
Cubic Splines
Using the property that yk = Sk (xk ) and yk+1 = Sk (xk+1 ), yields the
following equations:
mk 2 mk+1 2
yk = hk + pk hk and yk+1 = hk + qk hk . (4)
6 6
Solving for pk and qk and substituting these values to (3),
mk mk+1
Sk (x) = − (xk+1 − x)3 + (x − xk )3
6hk 6hk
yk mk hk yk+1 mk+1 hk
+ − (xk+1 − x) + − (x − xk ).
hk 6 hk 6
(5)
2(h0 + h1 )m1 + h1 m2 = u1
hn−2 mn−2 + 2(hn−2 + hn−1 )mn−1 = un−1
h02 h02
3h0 + 2h1 + m1 + h1 − m2 = u1
h1 h1
! !
2
hn−1 2
hn−1
hn−2 − mn−2 + 2hn−2 + 3hn−1 + mn−1 = un−1
hn−2 hn−2