# Cubic Spline

Learned in CS370.

$S(x)=a_{1}+b_{i}$

A cubic spline $S(x)$ is a piecewise cubic polynomial such that $S(x),S_{′}(x),S_{′′}(x)$ are all continuous at the knots.

Question

A cubic spline is a series of one or more cubic polynomials. Each polynomial applies to a different interval of the domain. This Ensures smooth transitions at interval boundaries.

$S(x)$ is a cubic polynomial on each particular subinterval $[x_{i},x_{i+1}]$, denoted by $S_{i}(x)$, for $i=1,...,n−1$. The following interpolating conditions must hold for i = 1, …, n − 1: $S_{i}(x_{i})=y_{i},S_{i}(x_{i+1})=y_{i+1}$ (which, we may note, ensures that the interpolant $S(x)$ is continuous at the knots) and, in addition, the following derivative continuity conditions must hold at the interior knots, for i = 1, …, n − 2:

\begin{align} S'_i(x_{i+1}) &= S'_{i+1}(x_{i+1}) \\ S''_i(x_{i+1}) &= S''_{i+1}(x_{i+1}) \end{align}$$ At this point, we should ask how many unknowns must be determined and how The two additional equations are typically specified by imposing some type of boundary conditions at x = x1 and x = xn. A free boundary has S′′(x1) = 0 or S′′(xn) = 0 . (2.4.5) A natural cubic spline has free boundaries at both ends. A clamped boundary has S′(x1) = specified or S′(xn) = specified ### Boundary Conditions ![[attachments/Screenshot 2024-01-24 at 11.22.06 AM.png]] ![[attachments/Screenshot 2024-01-24 at 11.22.12 AM.png]] ![[attachments/Screenshot 2024-01-24 at 10.32.16 AM.png]] ### Limitations While cubic splines are good for creating nice looking curves going through a set of interpolation points, they still have some limitations. In particular, it is often the case that one has points (x0, y0) ... (xn, yn) which give a rough drawing and one wishes to then create a smooth looking curve to provide the resulting picture. Unfortunately, when a picture is not quite correct looking one cannot simply change one of the interpolation points and expect to “correct” the curve. This is because changing one single interpolation point results in a global change to the curve. The problem we have is that asking a curve to interpolate a set of points is too strong of a condition for creating a particular curve or image. Rather we need a combination of interpolation and control points. Improvement: [[notes/Bezier Curve|Bezier Curve]] and [[notes/B-Spline|B-Spline]] curves which can be slightly corrected by moving a single control point.