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 DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException
interpolate
in interface UnivariateInterpolator
x
- Interpolating points array.y
- Interpolating values array.DimensionMismatchException
- if the array lengths are different.NumberIsTooSmallException
- if the number of points is less than 2.NonMonotonicSequenceException
- if x
is not sorted in
strictly increasing order.protected static double[] computeDividedDifference(double[] x, double[] y) throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException
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.DimensionMismatchException
- if the array lengths are different.NumberIsTooSmallException
- if the number of points is less than 2.NonMonotonicSequenceException
- if x
is not sorted in strictly increasing order.Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.