In mathematics, Neville's algorithm is an algorithm used for polynomial interpolation that was derived by the mathematician Eric Harold Neville in 1934. Given n + 1 points, there is a unique polynomial of degree ⤠n which goes through the given points. Neville's algorithm evaluates this polynomial.
Neville's algorithm is based on the Newton form of the interpolating polynomial and the recursion relation for the divided differences. It is similar to Aitken's algorithm (named after Alexander Aitken), which is nowadays not used.
Given a set of n+1 data points (x<sub>i</sub>, y<sub>i</sub>) where no two x<sub>i</sub> are the same, the interpolating polynomial is the polynomial p of degree at most n with the property
This polynomial exists and it is unique. Neville's algorithm evaluates the polynomial at some point x.
Let p<sub>i,j</sub> denote the polynomial of degree j − i which goes through the points (x<sub>k</sub>, y<sub>k</sub>) for k = i, i + 1, ..., j. The p<sub>i,j</sub> satisfy the recurrence relation
This recurrence can calculate
p<sub>0,n</sub>(x), which is the value being sought. This is Neville's algorithm.
For instance, for n = 4, one can use the recurrence to fill the triangular tableau below from the left to the right.
This process yields
p<sub>0,4</sub>(x), the value of the polynomial going through the n + 1 data points (x<sub>i</sub>, y<sub>i</sub>) at the point x.
This algorithm needs O(n<sup>2</sup>) floating point operations to interpolate a single point, and O(n<sup>3</sup>) floating point operations to interpolate a polynomial of degree n.
The derivative of the polynomial can be obtained in the same manner, i.e.:
In the above formulae, if we take the degree of the successive interpolating polynomials d = j − i and change the notation to p<sub>d,i</sub>,
The final value p<sub>n,0</sub> (in this notation) is the required interpolated value.
Since the number of computed items i.e. the range of i decreases with each successive d, a linear array can be used for memory efficiency with p<sub>i</sub> being overwritten and d being ignored. (For example: https://github.com/gisalgs/geom/blob/master/neville.py)
The derivative (using the product rule) can be computed likewise as:
As before, pâ²<sub>n,0</sub> (in this notation) is the derivative.
As this depends on the successive computed values of p also for each d, it may be computed within the same loop. If linear arrays for p and pâ² are used for efficiency, the pâ² values should be computed before the p values are overwritten.
Lyness and Moler showed in 1966 that using undetermined coefficients for the polynomials in Neville's algorithm, one can compute the Maclaurin expansion of the final interpolating polynomial, which yields numerical approximations for the derivatives of the function at the origin. While "this process requires more arithmetic operations than is required in finite difference methods", "the choice of points for function evaluation is not restricted in any way". They also show that their method can be applied directly to the solution of linear systems of the Vandermonde type.