See the note below for a description of a Cubic Spline.
The idea behind computing a cubic spline is as follows:
Let s(x) = a(i) + b(i)*x + c(i)*x^2 + d(i)*x*3 for x(i-1)<= x <= x(i), i = 1,..,n
This gives 4*n unknown coefficients. So, we need 4*n constraints to solve the problem.
First we require (i) s(x(i)) = y(i) for i = 0,1,...,n
Next we require (ii) s(x(i)+0) = s(x(i)-0); (iii) s'(x(i)+0) = s'(x(i)-0); (iv) s''(x(i)+0) = s''(x(i)-0) for i = 1,...,n-1
This gives us n+1 constraints from (i) and 3(n-1) constraints from (ii)-(iv). Thus, we have 4n-2 constraints leaving 2 degrees of freedom for choosing the coefficients.
If we make the second derivative of the 1st node and the last node zero then we have a "natural" cubic spline. This constraint is what has been chosen for the above cubic spline.
Another choice for the 2 degrees of freedom is to make s'''(x) to be continuous at x(1) and x(n-1). This choice is called the "not-a-knot" condition.
Note: In order to run the applet above your browser must use the JRE 1.1 or higher