|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.analysis.interpolation.DividedDifferenceInterpolator
public class DividedDifferenceInterpolator
Implements the Divided Difference Algorithm for interpolation of real univariate functions. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 2.
The actual code of Neville's evaluation is in PolynomialFunctionLagrangeForm, this class provides an easy-to-use interface to it.
Constructor Summary | |
---|---|
DividedDifferenceInterpolator()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DividedDifferenceInterpolator()
Method Detail |
---|
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).
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |