Figure 1:
Fitting with different degrees of the polynomial.
There are times when fitting an interpolating polynomial to data points is very difficult. Figure 1a is plot of
on the interval . It is a nice, smooth curve but has a pronounced maximum at and is near to the -axis for . The curves of Figure 1b,c, d, and e are for polynomials of degrees and that match the function at evenly
spaced points. None of the polynomials is a good representation of the function.
Figure 2:
Fitting with quadratic in subinterval.
One might think that a solution to the problem would be to break up the interval into subintervals and fit separate polynomials to the function in these smaller intervals. Figure 2 shows a much better fit if we use a quadratic between and , with outside that interval. That is better but there are discontinuities in the slope where the separate polynomials join.
An answer to the dilemma is to use spline curves. Spline curves may be of varying degrees. Suppose that we have a set of points (which do not have to be evenly spaced):
A spline fits a set of -degree polynomials, , between each pair of points, from to . The points at which the splines join are called knots.
Figure 3:
Linear spline.
If the polynomials are all of degree-1, we have a linear spline and the curve would appear as in the Fig. 3. The slopes are discontinuous where the segments join.