## org.apache.commons.math.analysis.interpolation
Class DividedDifferenceInterpolator

    java.lang.Object
      org.apache.commons.math.analysis.interpolation.DividedDifferenceInterpolator

All Implemented Interfaces:
  java.io.Serializable, UnivariateRealInterpolator

    public class DividedDifferenceInterpolator

extends java.lang.Object
implements UnivariateRealInterpolator, java.io.Serializable

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.

Since:
  1.2
Version:
  $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $
See Also:
  Serialized Form

Field Summary
`private static long` `serialVersionUID` serializable version identifier

Constructor Summary
`DividedDifferenceInterpolator()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  serializable version identifier

  See Also:
    Constant Field Values

Constructor Detail

### DividedDifferenceInterpolator

    public DividedDifferenceInterpolator()

Method Detail

### interpolate

    public PolynomialFunctionNewtonForm interpolate(double[] x,
                                                    double[] y)
                                             throws DuplicateSampleAbscissaException

  Computes an interpolating function for the data set.

  Specified by:
    `interpolate` in interface `UnivariateRealInterpolator`
  Parameters:
    `x` - the interpolating points array
    `y` - the interpolating values array
  Returns:
    a function which interpolates the data set
  Throws:
    `DuplicateSampleAbscissaException` - if arguments are invalid

### computeDividedDifference

    protected static double[] computeDividedDifference(double[] x,
                                                       double[] y)
                                                throws DuplicateSampleAbscissaException

  Returns a copy of the divided difference array.

  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).

  Parameters:
    `x` - the interpolating points array
    `y` - the interpolating values array
  Returns:
    a fresh copy of the divided difference array
  Throws:
    `DuplicateSampleAbscissaException` - if any abscissas coincide

Copyright (c) 2003-2011 Apache Software Foundation