# LEBESGUE Estimate the Lebesgue Constant

LEBESGUE is a C library which is given a set of nodes in 1D, and plots the Lebesgue function, and estimates the Lebesgue constant, which measures the maximum magnitude of the potential error of Lagrange polynomial interpolation, and which uses gnuplot to make plots of the Lebesgue function.

Any set of nodes in the real line X(I), for 1 <= I <= N, defines a corresponding set of Lagrange basis functions:

```        L(I)(X) = product ( 1 <= J <= N, J /= I ) ( X    - X(J) )
/ product ( 1 <= J <= N, J /= I ) ( X(I) - X(J) )
```
with the property that
```        L(I)(X(J)) = 0 if I /= J
1 if I  = J
```

The Lebesgue function is formed by the sum of the absolute values of these Lagrange basis functions:

```        LF(X) = sum ( 1 <= I <= N ) | L(I)(X) |
```
and the Lebesgue constant LC is the maximum value of LF(X) over the interpolation interval, which is typically X(1) to X(N), or min ( X(*) ), max ( X(*) ), or [-1,+1], or some user-defined interval.

### Languages:

LEBESGUE is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

### Related Data and Programs:

GNUPLOT, C programs which illustrate how a program can write data and command files so that gnuplot can create plots of the program results.

INTERP, a C library which can be used for parameterizing and interpolating data;

QUADRULE, a C library which defines quadrature rules for approximating an integral over a 1D domain.

### Reference:

1. Jean-Paul Berrut, Lloyd Trefethen,
Barycentric Lagrange Interpolation,
SIAM Review,
Volume 46, Number 3, September 2004, pages 501-517.

### Examples and Tests:

The test programs create plots of the Lebesgue function for specific sizes of the point sets.

### List of Routines:

• CHEBYSHEV1 returns the Type 1 Chebyshev points.
• CHEBYSHEV2 returns the Type 2 Chebyshev points.
• CHEBYSHEV3 returns the Type 3 Chebyshev points.
• CHEBYSHEV4 returns the Type 4 Chebyshev points.
• EQUIDISTANT1 returns the Type 1 Equidistant points.
• EQUIDISTANT2 returns the Type 2 Equidistant points.
• EQUIDISTANT3 returns the Type 3 Equidistant points.
• FEJER1 returns the Type 1 Fejer points.
• FEJER2 returns the Type 2 Fejer points.
• GET_UNIT returns a free FORTRAN unit number.
• LAGRANGE_VALUE evaluates the Lagrange polynomials.
• LEBESGUE_CONSTANT estimates the Lebesgue constant for a set of points.
• LEBESGUE_FUNCTION evaluates the Lebesgue function for a set of points.
• LEBESGUE_PLOT plots the Lebesgue function for a set of points.
• R8VEC_PRINT prints an R8VEC.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the C source codes.

Last revised on 03 March 2014.