Natural cubic spline:
If f is defined at a=x0<x1<...<xn=b, then f has a unique natural spline interpolation S on the nodes x0,x1,...,xn is given by,
Sj(x)=aj+bj(x-xj)+cj(x-xj)^2+dj(x-xj)^3 for j=0,1,...,n-1
To obtain the values of bj, cj, and dj use following formulas.
To obtain cj solve the equation Ax=b where,
bj = 1/hj(aj+1 - aj) - hj/3(2cj + cj+1), j=0,1,...,n-1
dj = 1/(3hj)(cj+1 - cj), j=0,1,...,n-1