Cubic Spline

Overview


The cubic spline splits the domain into a set of knot points. The spline interpolates the values between the knot points with a cubic polynomial as follows:
{% S_k(x) = d_k (x-x_k)^3 + c_k(x-x_k)^2 + b_k(x-x_k) + a_k %}

Boundary Conditions


Each cubic polynomial must match the value of the function at the knot points. Each polynomial must also match the polynomials that it is adjacent to in its first and second derivatives. For the first and last polynomial, there is one side which is not adjacent to another polynomial, so we cant match derivatives at the left and right boundaries. However, given these boundaries, there are still 2 degrees of freedom, so we have to set some additional constraints. The choice of constraints determines the type of cubic spline we use.

  • Natural : the natural boundary conditions sets the second derivatives of the two boundary points to zero
  • Clamped : clamped cubic spline sets the first derivatives at the boundaries to preset values.

Examples


Contents