public class DividedDifferenceInterpolator extends Object implements UnivariateInterpolator, 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)
Return a copy of the divided difference array.
|
PolynomialFunctionNewtonForm |
interpolate(double[] x,
double[] y)
Compute an interpolating function for the dataset.
|
public PolynomialFunctionNewtonForm interpolate(double[] x, double[] y) throws MathIllegalArgumentException
interpolate
in interface UnivariateInterpolator
x
- Interpolating points array.y
- Interpolating values array.MathIllegalArgumentException
- if the array lengths are different.MathIllegalArgumentException
- if the number of points is less than 2.MathIllegalArgumentException
- if x
is not sorted in
strictly increasing order.protected static double[] computeDividedDifference(double[] x, double[] y) throws MathIllegalArgumentException
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)\) where \(n\) is the common
length of x
and y
.
x
- Interpolating points array.y
- Interpolating values array.MathIllegalArgumentException
- if the array lengths are different.MathIllegalArgumentException
- if the number of points is less than 2.MathIllegalArgumentException
- if x
is not sorted in strictly increasing order.Copyright © 2016–2020 Hipparchus.org. All rights reserved.