Top Description Constructors Methods
org.apache.commons.math3.analysis.interpolation

public Class SplineInterpolator

extends Object
implements UnivariateInterpolator
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator
Imports
org.apache.commons.math3.analysis.polynomials.PolynomialFunction, .PolynomialSplineFunction, org.apache.commons.math3.exception.DimensionMismatchException, .NonMonotonicSequenceException, .NumberIsTooSmallException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.MathArrays

Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set.

The interpolate(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).

The cubic spline interpolation algorithm implemented is as described in R.L. Burden, J.D. Faires, Numerical Analysis, 4th Ed., 1989, PWS-Kent, ISBN 0-53491-585-X, pp 126-131.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PolynomialSplineFunction

Returns:

a function which interpolates the data set
interpolate
(double[]
the arguments for the interpolation points
x
,
double[]
the values for the interpolation points
y
)

Implements org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator.interpolate.

Deprecated as a consequence of PolynomialSplineFunction being deprecated.

Computes an interpolating function for the data set.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SplineInterpolatorback to summary
public SplineInterpolator()

Method Detail

interpolateback to summary
public PolynomialSplineFunction interpolate(double[] x, double[] y) throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException

Implements org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator.interpolate.

Deprecated

as a consequence of PolynomialSplineFunction being deprecated. See corresponding docs for further information.

Computes an interpolating function for the data set.

Parameters
x:double[]

the arguments for the interpolation points

y:double[]

the values for the interpolation points

Returns:PolynomialSplineFunction

a function which interpolates the data set

Exceptions
DimensionMismatchException:
if x and y have different sizes.
NumberIsTooSmallException:
if the size of x is smaller than 3.
NonMonotonicSequenceException:
if x is not sorted in strict increasing order.