Lately I have been working on an implementation of monotone smoothing splines, based on . As the title suggests, this technique is based on a univariate cubic B-spline. The form of the spline function used in the paper is as follows:
You can see that the constant α normalizes knot intervals to 1, and that the four <nobr>Ni(t)</nobr> are defined in this transformed space of unit-separated knots.
I’m interested in providing an interpolated splines using the Apache Commons Math API, in particular the PolynomialSplineFunction class. In principle the above is clearly such a polynomial, but there are a few hitches.
PolynomialSplineFunctionwants its knot intervals in closed standard polynomial form <nobr>ax3 + bx2 + cx + d</nobr>
- It wants each such polynomial expressed in transformed space <nobr>(x-Kj)</nobr>, where Kj is the greatest knot point that is <= x.
- The actual domain of S(x) is <nobr>K0 … Km-1</nobr>. The first 3 “negative” knots are there to make the summation for S(x) cleaner.
PolynomialSplineFunctionneeds its functions to be defined purely on the actual domain.
If you study the definition of <nobr>B3(t)</nobr> above, you can see that if x lands in the interval <nobr>[Kj, Kj+1)</nobr> then it is the four knot points <nobr>Kj-3 … Kj</nobr> that contribute to its value. This suggests a way to manipulate the equations into a standard form.
For a value x and its appropriate <nobr>Kj</nobr>, S(x) has four non-zero terms:
Consider the first term for (j-3). Recalling that knots are equally spaced by 1/α:
We can apply similar logic for each term to get:
and by plugging in the appropriate <nobr>Ni</nobr> for each term, we arrive at:
PolynomialSplineFunction is going to automatically identify the appropriate <nobr>Kj</nobr> and subtract it, and so I can define that transform as <nobr>u = x – Kj</nobr>, which gives:
I substitute αu into the definitions of the four <nobr>Ni</nobr> to obtain:
Lastly, collecting like terms gives me the standard-form coefficients that I need for
Now I am equipped to return a
PolynomialSplineFunction to my users, which implements the cubic B-spline that I fit to their data. Happy computing!
 H. Fujioka and H. Kano: Monotone smoothing spline curves using normalized uniform cubic B-splines, Trans. Institute of Systems, Control and Information Engineers, Vol. 26, No. 11, pp. 389–397, 2013
Source From: fedoraplanet.org.
Original article title: Erik Erlandson: Putting Cubic B-Splines into Standard Polynomial Form.
This full article can be read at: Erik Erlandson: Putting Cubic B-Splines into Standard Polynomial Form.