Cubic Spline

Ryan Hirst
In Numerical Analysis, a spline S(x) of degree m is a function defined on an interval I = [a, b] which
  • coincides with a polynomial of degree m on each subinterval (at each tabular point),
  • has continuous derivatives through order m-1
This leaves two free parameters, which are generally used to satisfy endpoint conditions. Here, S(x) matches slope of f(x) at the endpoints: We so often choose m=3 and S(x) composed of piecewise cubic polynomials, I will simply write "spline" to mean "cubic spline". I continue to assume the points are evenly spaced.
  • The spline is peicewise continuous: it is less sensitive to small local changes such as discontinuities, escalating derivatives, and data errors. For example, the sample function above contains a term in the form g(x) = k |x-c|. Weierstrass' pretty theorem will fail: Polynomial[Pts] will not converge to f(x) as n increases. (Why?)
  • The given conditions on S(x) lead to a tridiagonal matrix whose solution gives the coefficients of each subcurve (in red). For increased numerical stability, I have solved the system in advance, and used the resulting series to give the coefficients more directly.
_____ Tool: Spline[{Points},n, y'(a), y'(b) ], for *equally spaced points*: