## Class ClampedSplineInterpolator

• All Implemented Interfaces:
UnivariateInterpolator

public class ClampedSplineInterpolator
extends SplineInterpolator
Computes a clamped cubic spline interpolation for the data set.

The interpolate(double[], double[], double, double) method returns a PolynomialSplineFunction consisting of n cubic polynomials, defined over the subintervals determined by the x values, x[0] < x[i] ... < x[n]. The x values are referred to as "knot points."

The value of the PolynomialSplineFunction at a point x that is greater than or equal to the smallest knot point and strictly less than the largest knot point is computed by finding the subinterval to which x belongs and computing the value of the corresponding polynomial at x - x[i] where i is the index of the subinterval. See PolynomialSplineFunction for more details.

The interpolating polynomials satisfy:

1. The value of the PolynomialSplineFunction at each of the input x values equals the corresponding y value.
2. Adjacent polynomials are equal through two derivatives at the knot points (i.e., adjacent polynomials "match up" at the knot points, as do their first and second derivatives).
3. The clamped boundary condition, i.e., the PolynomialSplineFunction takes "a specific direction" at both its start point and its end point by providing the desired first derivative values (slopes) as function parameters to interpolate(double[], double[], double, double).

The clamped cubic spline interpolation algorithm implemented is as described in R.L. Burden, J.D. Faires, Numerical Analysis, 9th Ed., 2010, Cengage Learning, ISBN 0-538-73351-9, pp 153-156.

• ### Constructor Summary

Constructors
Constructor Description
ClampedSplineInterpolator()
• ### Method Summary

All Methods
Modifier and Type Method Description
PolynomialSplineFunction interpolate​(double[] x, double[] y, double fpo, double fpn)
Computes an interpolating function for the data set.
• ### Methods inherited from class org.apache.commons.math4.legacy.analysis.interpolation.SplineInterpolator

interpolate
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### ClampedSplineInterpolator

public ClampedSplineInterpolator()
• ### Method Detail

• #### interpolate

public PolynomialSplineFunction interpolate​(double[] x,
double[] y,
double fpo,
double fpn)
throws DimensionMismatchException,
NumberIsTooSmallException,
NonMonotonicSequenceException
Computes an interpolating function for the data set.
Parameters:
x - the arguments for the interpolation points
y - the values for the interpolation points
fpo - first derivative at the starting point of the returned spline function (starting slope), satisfying clamped boundary condition S′(x0) = f′(x0)
fpn - first derivative at the ending point of the returned spline function (ending slope), satisfying clamped boundary condition S′(xn) = f′(xn)
Returns:
a function which interpolates the data set
Throws:
DimensionMismatchException - if x and y have different sizes.
NumberIsTooSmallException - if the size of x < 3.
NonMonotonicSequenceException - if x is not sorted in strict increasing order.