Class NevilleTable

  • All Implemented Interfaces:
    OnlineInterpolator, Function<Vector,​Double>, RealScalarFunction, UnivariateRealFunction

    public class NevilleTable
    extends AbstractUnivariateRealFunction
    implements OnlineInterpolator
    Neville's algorithm is a polynomial interpolation algorithm. Given n + 1 points, there is a unique polynomial of degree ≤ n which associates with them. Neville's algorithm evaluates this polynomial for a given input x.

    This implementation is based on filling out the Neville table. This table can be used in two ways. First, it can be used to compute the interpolated function f(x). Second, it can be used in an incremental manner by adding a few, say one, data points each time to allow for examination of the table values.

    See Also:
    Wikipedia: Neville's algorithm
    • Constructor Detail

      • NevilleTable

        public NevilleTable​(int n,
                            OrderedPairs f)
        Construct a Neville table of size n, initialized with data {(x, y)}. The size n is only indicative. If there are more data points than n, the table size grows accordingly.
        Parameters:
        n - indicative size; make this big for reservation to add new data points
        f - the points to be interpolated
      • NevilleTable

        public NevilleTable​(OrderedPairs f)
        Construct a Neville table of size n, initialized with data {(x, y)}.
        Parameters:
        f - the points to be interpolated
      • NevilleTable

        public NevilleTable()
        Construct an empty Neville table.
    • Method Detail

      • N

        public int N()
        Get the number of data points.
        Returns:
        the number of data points
      • getTable

        public double[][] getTable()
        Get a copy of the Neville table.
        Returns:
        a copy of the table
      • x

        public double[] x()
        Get a copy of the x's.
        Returns:
        a copy of x's.
      • get

        public double get​(int i,
                          int j)
        Get the value of a table entry.
        Parameters:
        i - row index, counting from 0
        j - column index, counting from 0
        Returns:
        the value of the table entry