# Legendre-Gauss Quadrature formula

The **Legendre-Gauss Quadrature formula** or **Gauss-Legendre quadrature** is the numeric approximation of a definite integral,

It is possible to choose quadrature points *x*_{i} and weights *w*_{i}, so that polynomial functions of degree smaller than 2*N* are integrated exactly by equation (1).

The Legendre-Gauss quadrature formula is a special case of Gaussian quadratures which allow efficient approximation of a function with known asymptotic behavior at the edges of the interval of integration. Gauss quadrature is especially recommended if the integrand is holomorphic in a neighbourhood of integration interval.

## Contents |

## [edit] Points and weights

The points *x*_{i} in equation (1) are zeros of the Legendre polynomial *P*_{N}(*x*) of order *N*:

It can be shown that the zeros are real and lie in the interval (−1, 1):

The weights *w*_{i} in equation (1) can be expressed by

where the prime indicates a first derivative.

There is no straightforward expression for the zeros *x*_{i}; they can be approximated to many decimal places through only few iterations, solving numerically equation (2) with the initial values

These formulas are described in the books
^{[1]}
^{[2]}

## [edit] Precision of the approximation

If the integrand is a holomorphic function along the path of integration, then the error of approximation decreases exponentially in the number *N*. If the integrand is a polynomial of degree 2*N*−1 or less, then the *N*-point Legendre-Gauss quadrature yields the exact answer.

If the integrand contains a singularity, then the formula still can be used, but the approximation is poor. In that case, one may consider to use another Gaussian quadrature, more suitable for the specific function. Alternatively, it may be possible to deform the contour of integration to avoid the singularity if it is inside the integration interval. Another possibility is to do a substitution that makes the integrand regular.

## [edit] Examples

In Fig.1, the base-10 logarithm of the modulus of the residual of the approximation of integral with Gaussian quadrature is shown versus number of terms in the sum, for four examples of the integrand.

- (black)
- (red)
- (green)
- (blue)

The first of these functions is integrated exactly at *N* > 8, and the residual is determined by the rounding errors of the long double arithmetic.
The second function (red) has branch points at the end of the interval; therefore, the approximation does not improve quickly at the increase of number terms in the sum. The last two functions are analytic within the range of integration; the residual decreases exponentially, and the precision of evaluation of the integral is limited only by the rounding errors.
The logarithm of the modulus of the residual is plotted versus number of points in the quadrature formula. If the residual is positive, it is represented as a circle; if it is negative, it is represented as a dot. Out of the grid, at the bottom of the figure, the precision is not sufficient for reliable plotting.

*See Legendre-Gauss Quadrature formula/code for the code that generated figure 1*.

## [edit] References

- ↑ Abramovitz, Milton; I. Stegun (1964).
*Handbook of mathematical functions*. National Bureau of Standards. ISBN 0-486-61272-4. - ↑ W.H.Press, S.A.Teukolsky, W.T.Vetterling, B.P.Flannery (1988).
*Numerical Resipes in C*. Cambridge University Press. ISBN 0-521-43108-5.

Some content on this page may previously have appeared on Citizendium. |