# LAGRANGE_ND Multivariate Lagrange Interpolation

LAGRANGE_ND, a MATLAB library which is given a set of ND points X(*) in D-dimensional space, and constructs a family of ND Lagrange polynomials P(*)(X), associating polynomial P(i) with point X(i), such that, for 1 <= i <= ND,

```        P(i)(X(i)) = 1
```
but, if i =/= j
```        P(i)(X(j)) = 0
```

The library currently includes the following primary routines:

• LAGRANGE_COMPLETE requires that the number of data points ND is exactly equal to R, the number of monomials in D dimensions of total degree N or less;
• LAGRANGE_COMPLETE2, a version of LAGRANGE_COMPLETE with improved "pivoting";
• LAGRANGE_PARTIAL allows the number of data points ND to be less than or equal to R, the number of monomials in D dimensions of total degree N or less;
• LAGRANGE_PARTIAL2, a version of LAGRANGE_PARTIAL with improved "pivoting".

The set of ND polynomials P(*)(X) are returned as a set of three arrays:

• PO(i) contains the order, the number of nonzero coefficients, for polynomial i;
• PC(i,j) contains the coefficient of the j-th term in polynomial i;
• PE(i,j) contains a code for the exponents of the monomial associated with the j-th term in polynomial i.

Each value of PE(i,j) is an exponent codes which can be converted to a vector of exponents that define a monomial. For example, if we are working in spatial dimension D=3, then if PE(i,j)=13, the corresponding exponent vector is (0,2,1), so this means that the j-th term in polynomial i is

```        PC(i,j) * x^0 y^2 z^1
```
An exponent code can be converted to an exponent vector by calling mono_unrank_grlex().

### Languages:

LAGRANGE_ND is available in a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

LAGRANGE_INTERP_ND, a MATLAB library which defines and evaluates the Lagrange polynomial p(x) which interpolates a set of multivariate data, so that p(x(i)) = y(i).

SPARSE_INTERP_ND a MATLAB library which can be used to define a sparse interpolant to a function f(x) of a multidimensional argument.

SPINTERP, a MATLAB library which carries out piecewise multilinear hierarchical sparse grid interpolation; an earlier version of this software is ACM TOMS Algorithm 847, by Andreas Klimke;

TEST_INTERP_ND, a MATLAB library which defines test problems for interpolation of data z(x), depending on an M-dimensional argument.

### Reference:

1. Philip Davis,
Interpolation and Approximation,
Dover, 1975,
ISBN: 0-486-62495-1,
LC: QA221.D33
2. Tomas Sauer, Yuan Xu,
On multivariate Lagrange interpolation,
Mathematics of Computation,
Volume 64, Number 211, July 1995, pages 1147-1170.