divdif, a Python code which creates, prints and manipulates divided difference polynomials from a table of values (x,f(x)). The code can compute the coefficients of the Newton and power sum forms of the interpolating polynomial. It can compute the derivative or antiderivate polynomial. It can compute the form of the Lagrange basis polynomials. It can compute the points and weights for Newton Cotes quadrature rules. It can compute the weights for a Lagrange interpolation scheme.
Divided difference polynomials are a systematic method of computing polynomial approximations to scattered data. The representations are compact, and may easily be updated with new data, rebased at zero, or analyzed to produce the standard form polynomial, integral or derivative polynomials.
Other routines are available to convert the divided difference representation to standard polynomial format. This is a natural way to determine the coefficients of the polynomial that interpolates a given set of data, for instance.
One surprisingly simple but useful routine is available to take a set of roots and compute the divided difference or standard form polynomial that passes through those roots.
Finally, the Newton-Cotes quadrature formulas can be derived using divided difference methods, so a few routines are given which can compute the weights and abscissas of open or closed rules for an arbitrary number of nodes.
The information on this web page is distributed under the MIT license.
divdif is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.
bernstein_polynomial, a Python code which evaluates the Bernstein polynomials, useful for uniform approximation of functions;
chebyshev_polynomial, a Python code which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.
differ, a Python code which determines the finite difference coefficients necessary in order to combine function values at known locations to compute an approximation of given accuracy to a derivative of a given order.
hermite_polynomial, a Python code which computes the Hermite interpolant, a polynomial that matches function values and derivatives.
lagrange_interp_1d, a Python code which defines and evaluates the Lagrange polynomial p(x) which interpolates a set of data, so that p(x(i)) = y(i).
rbf_interp_1d, a Python code which defines and evaluates radial basis function (RBF) interpolants to 1D data.
shepard_interp_1d, a Python code which defines and evaluates Shepard interpolants to 1D data, which are based on inverse distance weighting.
test_interp_1d, a Python code which defines test problems for interpolation of data y(x), depending on a 1D argument.
vandermonde_interp_1d, a Python code which finds a polynomial interpolant to a function of 1D data by setting up and solving a linear system for the polynomial coefficients, involving the Vandermonde matrix.