public class DividedDifferenceInterpolator extends Object implements UnivariateRealInterpolator, Serializable
The actual code of Neville's evaluation is in PolynomialFunctionLagrangeForm, this class provides an easy-to-use interface to it.
Constructor and Description |
---|
DividedDifferenceInterpolator() |
Modifier and Type | Method and Description |
---|---|
protected static double[] |
computeDividedDifference(double[] x,
double[] y)
Returns a copy of the divided difference array.
|
PolynomialFunctionNewtonForm |
interpolate(double[] x,
double[] y)
Computes an interpolating function for the data set.
|
public PolynomialFunctionNewtonForm interpolate(double[] x, double[] y) throws DuplicateSampleAbscissaException
interpolate
in interface UnivariateRealInterpolator
x
- the interpolating points arrayy
- the interpolating values arrayDuplicateSampleAbscissaException
- if arguments are invalidprotected static double[] computeDividedDifference(double[] x, double[] y) throws DuplicateSampleAbscissaException
The divided difference array is defined recursively by
f[x0] = f(x0) f[x0,x1,...,xk] = (f(x1,...,xk) - f(x0,...,x[k-1])) / (xk - x0)
The computational complexity is O(N^2).
x
- the interpolating points arrayy
- the interpolating values arrayDuplicateSampleAbscissaException
- if any abscissas coincideCopyright © 2003-2012 Apache Software Foundation. All Rights Reserved.