cubic-splines-interpolation

A quadratic polynomial \(p(x)=ax^2+bx+c\) has only three degrees of freedom \((a,b,c)\). If you want your quadratic function to run through two points, you already have only one degree of freedom left. If the the slope of the curve at one of the end-points is fixed, this uses up the last degree of freedom, leaving no choice of slope at the other end. A cubic polynomial \(ax^3+bx^2+cx+d\) has four degrees of freedom, thus allowing to prescribe four conditions – passing through two points and having specific slopes at the two end points.

Quadratic functions are more ringed. It’s because, a quadratic has a fixed degree of bentness. If we glue together a few quadratics, to interpolate a set of points, a passenger roller-coaster travelling on this curve would experience long ascents and descents. Cubics are more relaxed. Unlike cubics, quadratics can’t have a point of inflexion. Intuitively, this is why, cubic polynomials are used for interpolating a set of points.

However, quadratic splines also have many applications, for example, they are used while designing true type fonts.

Cubic splines are also use to construct cubic Bezier curves used in car designing.

I have put together the intuition, the math behind cubic splines and a python code snippet implementing the algorithm in this notebook.