Notes on Atkinson & Han’s Presentation on Cubic Splines:
Let s’’(x) = Mj-1(xj – x)/(xj – xj-1)+ Mj (x – xj-1)/(xj – xj-1) for x in (xj-1, xj).
Thens(x) is at most cubic on each of theintervals (x1, x2), (x2, x3), ….,
(xn-1, xn)and s’’(xj) = Mj, for each j.
We want to choose these Mj’s so that s(xj) = yj for j = 1 to n, where the
yj’s are given data or possibly come from some known function y = f(x).
The Mj’s are unknown, so we need n equations to determine them…
Here’s what we want from s:
(S1) s is of degree at most 3 on each interval (xj-1, xj) with 2 j n;
(S2) s’ and s’’ are continuous across the interval x1xxn;
(S3) s’’(x1) = s’’xn) = 0.
Note: (S3) gives the natural cubic spline, but other choices are possible.
Anti-differentiatings”x) and then s’(x)in (xj-1, xj) yields:
1. s’(x) = (-½)Mj-1(xj – x)2/(xj – xj-1) + (½)Mj (x – xj-1)2/(xj – xj-1) + C1
2. s(x) = (1/6)Mj-1(xj – x)3/(xj – xj-1) + (1/6)Mj (x – xj-1)3/(xj – xj-1) + C1(x – xj-1) + C2
Then, sinceyj-1 =s(xj-1), C2 = yj-1 – (1/6)Mj-1(xj – xj-1)2, and because yj= s(xj),
C1 = (yj– (1/6)Mj(xj – xj-1)2 –yj-1 + (1/6)Mj-1(xj – xj-1)2)/(xj – xj-1)
= (yj – yj-1)/(xj – xj-1) + (1/6)(Mj-1–Mj)(xj – xj-1)
Therefore, onthe subinterval (xj-1, xj), the cubic spline s(x) is given by…
(1/6)Mj-1(xj – x)3/(xj – xj-1) + (1/6)Mj(x – xj-1)3/(xj – xj-1) +
((yj – yj-1)/(xj – xj-1) + (1/6)(Mj-1–Mj)(xj – xj-1))(x – xj-1) +yj-1 – (1/6)Mj-1(xj – xj-1)2
= (1/6)(Mj-1(xj – x)3 + Mj (x – xj-1)3)/(xj – xj-1) + yj-1(xj – x)/(xj – xj-1) +
yj(x –xj-1)/(xj – xj-1) + (1/6)(Mj-1(x – xj) –Mj(x – xj-1))(xj – xj-1).
Now, a continuous first and second derivative, i.e. at each of the interior nodes
{x2, x3, …, xn-1}, requires that s’(xj-) = s’(xj+) (continuity of s’’is built-in).
Since on (xj-1, xj),
s’(x) = (-½)Mj-1(xj – x)2/(xj – xj-1) + (½) Mj (x – xj-1)2/(xj – xj-1) +
(yj – yj-1)/(xj – xj-1) + (1/6)(Mj-1–Mj)(xj – xj-1),
it follows that
s’(xj–) = (½) Mj (xj – xj-1) + (yj – yj-1)/(xj – xj-1) + (1/6)(Mj-1–Mj)(xj – xj-1).
Likewise, since on (xj, xj+1),
s’(x) = (-½)Mj(xj+1 – x)2/(xj+1 – xj) + (½) Mj+1(x – xj)2/(xj+1 – xj) +
(yj+1 – yj)/(xj+1 – xj) + (1/6)(Mj –Mj+1)(xj+1 – xj),
it must hold that
s’(xj+) = (-½) Mj (xj+1 – xj) + (yj+1 – yj)/(xj+1 – xj) + (1/6)(Mj –Mj+1)(xj+1 – xj).
This requires that the Mj’s satisfy the following tri-diagonallinear system:
(1/6)(xj – xj-1) Mj-1 + (1/3)(xj+1 – xj-1)Mj+ (1/6)(xj+1 – xj)Mj+1 =
(yj+1 – yj)/(xj+1 – xj)–(yj – yj-1)/(xj – xj-1), with 2 j n-1.
But since this system only has n-2 equations, 2 more are required to determine the Mj’s.
These2 additional equationsmighttake any of several forms:
i)Take M1Mnto both be 0(these are callednatural cubic splines);
ii)Take M1= f’’(x1) Mn= f’’(xn), with fknown and yj = f(xj), all j’s;
iii)Take s’(x1) = f’(x1) & s’(xn)= f’(xn), with f known and yj = f(xj), all j’s;
iv)Take s(z1) = f(z1) & s(z2)= f(z2), with f known and yj = f(xj), for all j’s,
with x1 z1x2xn-1 z2xn (these are called not-a-knot splines)