Samiksha Jaiswal (Editor)

Gaussian quadrature

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Gaussian quadrature

In numerical analysis, a quadrature rule is an approximation of the definite integral of a function, usually stated as a weighted sum of function values at specified points within the domain of integration. (See numerical integration for more on quadrature rules.) An n-point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree 2n − 1 or less by a suitable choice of the points xi and weights wi for i = 1, ..., n. The domain of integration for such a rule is conventionally taken as [−1, 1], so the rule is stated as

Contents

1 1 f ( x ) d x = i = 1 n w i f ( x i ) .

Gaussian quadrature as above will only produce good results if the function f(x) is well approximated by a polynomial function within the range [−1, 1]. The method is not, for example, suitable for functions with singularities. However, if the integrated function can be written as f ( x ) = ω ( x ) g ( x ) , where g(x) is approximately polynomial and ω(x) is known, then alternative weights w i and points x i that depend on the weighting function ω(x) may give better results, where

1 1 f ( x ) d x = 1 1 ω ( x ) g ( x ) d x i = 1 n w i g ( x i ) .

Common weighting functions include ω ( x ) = 1 / 1 x 2 (Chebyshev–Gauss) and ω ( x ) = e x 2 (Gauss–Hermite).

It can be shown (see Press, et al., or Stoer and Bulirsch) that the evaluation points xi are just the roots of a polynomial belonging to a class of orthogonal polynomials.

Gauss–Legendre quadrature

For the simplest integration problem stated above, i.e. with ω ( x ) = 1 , the associated polynomials are Legendre polynomials, Pn(x), and the method is usually known as Gauss–Legendre quadrature. With the n-th polynomial normalized to give Pn(1) = 1, the i-th Gauss node, xi, is the i-th root of Pn; its weight is given by (Abramowitz & Stegun 1972, p. 887)

w i = 2 ( 1 x i 2 ) [ P n ( x i ) ] 2 .

Some low-order rules for solving the integration problem are listed below (over interval [−1, 1], see the section below for other intervals).

Change of interval

An integral over [a, b] must be changed into an integral over [−1, 1] before applying the Gaussian quadrature rule. This change of interval can be done in the following way:

a b f ( x ) d x = b a 2 1 1 f ( b a 2 x + a + b 2 ) d x .

Applying the Gaussian quadrature rule then results in the following approximation:

a b f ( x ) d x b a 2 i = 1 n w i f ( b a 2 x i + a + b 2 ) .

Other forms

The integration problem can be expressed in a slightly more general way by introducing a positive weight function ω into the integrand, and allowing an interval other than [−1, 1]. That is, the problem is to calculate

a b ω ( x ) f ( x ) d x

for some choices of a, b, and ω. For a = −1, b = 1, and ω(x) = 1, the problem is the same as that considered above. Other choices lead to other integration rules. Some of these are tabulated below. Equation numbers are given for Abramowitz and Stegun (A & S).

Fundamental theorem

Let pn be a nontrivial polynomial of degree n such that

a b ω ( x ) x k p n ( x ) d x = 0 , for all  k = 0 , 1 , , n 1.

If we pick the n nodes xi to be the zeros of pn, then there exist n weights wi which make the Gauss-quadrature computed integral exact for all polynomials h(x) of degree 2n − 1 or less. Furthermore, all these nodes xi will lie in the open interval (a, b) (Stoer & Bulirsch 2002, pp. 172–175).

The polynomial pn is said to be an orthogonal polynomial of degree n associated to the weight function ω(x). It is unique up to a constant normalization factor. The idea underlying the proof is that, because of its sufficiently low degree, h(x) can be divided by p n ( x ) to produce a quotient q(x) of degree strictly lower than n, and a remainder r(x) of still lower degree, so that both will be orthogonal to p n ( x ) , by the defining property of p n ( x ) . Thus

a b ω ( x ) h ( x ) d x = a b ω ( x ) r ( x ) d x .

Because of the choice of nodes xi, the corresponding relation

i = 1 n w i h ( x i ) = i = 1 n w i r ( x i )

holds also. The exactness of the computed integral for h ( x ) then follows from corresponding exactness for polynomials of degree only n or less (as is r ( x ) ).

General formula for the weights

The weights can be expressed as

w i = a n a n 1 a b ω ( x ) p n 1 ( x ) 2 d x p n ( x i ) p n 1 ( x i ) (1)

where a k is the coefficient of x k in p k ( x ) . To prove this, note that using Lagrange interpolation one can express r(x) in terms of r ( x i ) as

r ( x ) = i = 1 n r ( x i ) 1 j n j i x x j x i x j

because r(x) has degree less than n and is thus fixed by the values it attains at n different points. Multiplying both sides by ω(x) and integrating from a to b yields

a b ω ( x ) r ( x ) d x = i = 1 n r ( x i ) a b ω ( x ) 1 j n j i x x j x i x j d x

The weights wi are thus given by

w i = a b ω ( x ) 1 j n j i x x j x i x j d x

This integral expression for w i can be expressed in terms of the orthogonal polynomials p n ( x ) and p n 1 ( x ) as follows.

We can write

1 j n j i ( x x j ) = 1 j n ( x x j ) x x i = p n ( x ) a n ( x x i )

where a n is the coefficient of x n in p n ( x ) . Taking the limit of x to x i yields using L'Hôpital's rule

1 j n j i ( x i x j ) = p n ( x i ) a n

We can thus write the integral expression for the weights as

w i = 1 p n ( x i ) a b ω ( x ) p n ( x ) x x i d x ---------(2)

In the integrand, writing

1 x x i = 1 ( x x i ) k x x i + ( x x i ) k 1 x x i

yields

a b ω ( x ) x k p n ( x ) x x i d x = x i k a b ω ( x ) p n ( x ) x x i d x

provided k n , because

1 ( x x i ) k x x i

is a polynomial of degree k-1 which is then orthogonal to p n ( x ) . So, if q(x) is a polynomial of at most nth degree we have

a b ω ( x ) p n ( x ) x x i d x = 1 q ( x i ) a b ω ( x ) q ( x ) p n ( x ) x x i d x

We can evaluate the integral on the right hand side for q ( x ) = p n 1 ( x ) as follows. Because p n ( x ) x x i is a polynomial of degree n-1, we have

p n ( x ) x x i = a n x n 1 + s ( x )

where s(x) is a polynomial of degree n 2 . Since s(x) is orthogonal to p n 1 ( x ) we have

a b ω ( x ) p n ( x ) x x i d x = a n p n 1 ( x i ) a b ω ( x ) p n 1 ( x ) x n 1 d x

We can then write

x n 1 = ( x n 1 p n 1 ( x ) a n 1 ) + p n 1 ( x ) a n 1

The term in the brackets is a polynomial of degree n 2 , which is therefore orthogonal to p n 1 ( x ) . The integral can thus be written as

a b ω ( x ) p n ( x ) x x i d x = a n a n 1 p n 1 ( x i ) a b ω ( x ) p n 1 ( x ) 2 d x

According to Eq. (2), the weights are obtained by dividing this by p n ( x i ) and that yields the expression in Eq. (1).

w i can also be expressed in terms of the orthogonal polynomials p n ( x ) and now p n + 1 ( x ) . In the 3-term recurrence relation p n + 1 ( x i ) = ( a ) p n ( x i ) + ( b ) p n 1 ( x i ) the term with p n ( x i ) vanishes, so p n 1 ( x i ) in Eq. (1) can be replaced by p n + 1 ( x i ) / b .

Proof that the weights are positive

Consider the following polynomial of degree 2n-2

f ( x ) = 1 j n j i ( x x j ) 2

where as above the xj are the roots of the polynomial p n ( x ) . Since the degree of f(x) is less than 2n-1, the Gaussian quadrature formula involving the weights and nodes obtained from p n ( x ) applies. Since f ( x j ) = 0 for j not equal to i, we have

a b ω ( x ) f ( x ) d x = j = 1 N w j f ( x j ) = w i f ( x i ) .

Since both ω ( x ) and f(x) are non-negative functions, it follows that w i > 0 .

Computation of Gaussian quadrature rules

For computing the nodes xi and weights wi of Gaussian quadrature rules, the fundamental tool is the three-term recurrence relation satisfied by the set of orthogonal polynomials associated to the corresponding weight function. For n points, these nodes and weights can be computed in O(n2) operations by an algorithm derived by Gautschi (1968).

Gautschi's theorem

Gautschi's theorem (Gautschi, 1968) states that orthogonal polynomials p r with ( p r , p s ) = 0 for r s for a scalar product ( , ) , degree ( p r ) = r and leading coefficient one (i.e. monic orthogonal polynomials) satisfy the recurrence relation

p r + 1 ( x ) = ( x a r , r ) p r ( x ) a r , r 1 p r 1 ( x ) a r , 0 p 0 ( x )

and scalar product defined

( f ( x ) , g ( x ) ) = a b ω ( x ) f ( x ) g ( x ) d x

for r = 0 , 1 , , n 1 where n is the maximal degree which can be taken to be infinity, and where a r , s = ( x p r , p s ) / ( p s , p s ) . First of all, the polynomials defined by the recurrence relation starting with p 0 ( x ) = 1 have leading coefficient one and correct degree. Given the starting point by p 0 , the orthogonality of p r can be shown by induction. For r = s = 0 one has

( p 1 , p 0 ) = ( x a 0 , 0 ) ( p 0 , p 0 ) = ( x p 0 , p 0 ) a 0 , 0 ( p 0 , p 0 ) = ( x p 0 , p 0 ) ( x p 0 , p 0 ) = 0.

Now if p 0 , p 1 , , p r are orthogonal, then also p r + 1 , because in

( p r + 1 , p s ) = ( x p r , p s ) a r , r ( p r , p s ) a r , r 1 ( p r 1 , p s ) a r , 0 ( p 0 , p s )

all scalar products vanish except for the first one and the one where p s meets the same orthogonal polynomial. Therefore,

( p r + 1 , p s ) = ( x p r , p s ) a r , s ( p s , p s ) = ( x p r , p s ) ( x p r , p s ) = 0.

However, if the scalar product satisfies ( x f , g ) = ( f , x g ) (which is the case for Gaussian quadrature), the recurrence relation reduces to a three-term recurrence relation: For s r 1 , x p s is a polynomial of degree less than or equal to r − 1. On the other hand, p r is orthogonal to every polynomial of degree less than or equal to r − 1. Therefore, one has ( x p r , p s ) = ( p r , x p s ) = 0 and a r , s = 0 for s < r − 1. The recurrence relation then simplifies to

p r + 1 ( x ) = ( x a r , r ) p r ( x ) a r , r 1 p r 1 ( x )

or

p r + 1 ( x ) = ( x a r ) p r ( x ) b r p r 1 ( x )

(with the convention p 1 ( x ) 0 ) where

a r := ( x p r , p r ) ( p r , p r ) , b r := ( x p r , p r 1 ) ( p r 1 , p r 1 ) = ( p r , p r ) ( p r 1 , p r 1 )

(the last because of ( x p r , p r 1 ) = ( p r , x p r 1 ) = ( p r , p r ) , since x p r 1 differs from p r by a degree less than r).

The Golub-Welsch algorithm

The three-term recurrence relation can be written in the matrix form J P ~ = x P ~ p n ( x ) × e n where P ~ = [ p 0 ( x ) , p 1 ( x ) , . . . , p n 1 ( x ) ] T , e n is the n th standard basis vector, i.e. e n = [ 0 , . . . , 0 , 1 ] T , and J is the so-called Jacobi matrix:

J = ( a 0 1 0 b 1 a 1 1 0 0 b 2 a 2 1 0 0 0 0 b n 2 a n 2 1 0 b n 1 a n 1 )

The zeros x j of the polynomials up to degree n which are used as nodes for the Gaussian quadrature can be found by computing the eigenvalues of this tridiagonal matrix. This procedure is known as Golub–Welsch algorithm.

For computing the weights and nodes, it is preferable to consider the symmetric tridiagonal matrix J with elements

J i , i = J i , i = a i 1 i = 1 , , n J i 1 , i = J i , i 1 = J i , i 1 J i 1 , i = b i 1 i = 2 , , n .

J and J are similar matrices and therefore have the same eigenvalues (the nodes). The weights can be computed from the corresponding eigenvectors: If ϕ ( j ) is a normalized eigenvector (i.e., an eigenvector with euclidean norm equal to one) associated to the eigenvalue xj, the corresponding weight can be computed from the first component of this eigenvector, namely:

w j = μ 0 ( ϕ 1 ( j ) ) 2

where μ 0 is the integral of the weight function

μ 0 = a b ω ( x ) d x .

See, for instance, (Gil, Segura & Temme 2007) for further details.

Error estimates

The error of a Gaussian quadrature rule can be stated as follows (Stoer & Bulirsch 2002, Thm 3.6.24). For an integrand which has 2n continuous derivatives,

a b ω ( x ) f ( x ) d x i = 1 n w i f ( x i ) = f ( 2 n ) ( ξ ) ( 2 n ) ! ( p n , p n )

for some ξ in (a, b), where pn is the monic (i.e. the leading coefficient is 1) orthogonal polynomial of degree n and where

( f , g ) = a b ω ( x ) f ( x ) g ( x ) d x .

In the important special case of ω(x) = 1, we have the error estimate (Kahaner, Moler & Nash 1989, §5.2)

( b a ) 2 n + 1 ( n ! ) 4 ( 2 n + 1 ) [ ( 2 n ) ! ] 3 f ( 2 n ) ( ξ ) , a < ξ < b .

Stoer and Bulirsch remark that this error estimate is inconvenient in practice, since it may be difficult to estimate the order 2n derivative, and furthermore the actual error may be much less than a bound established by the derivative. Another approach is to use two Gaussian quadrature rules of different orders, and to estimate the error as the difference between the two results. For this purpose, Gauss–Kronrod quadrature rules can be useful.

Gauss–Kronrod rules

If the interval [a, b] is subdivided, the Gauss evaluation points of the new subintervals never coincide with the previous evaluation points (except at zero for odd numbers), and thus the integrand must be evaluated at every point. Gauss–Kronrod rules are extensions of Gauss quadrature rules generated by adding n + 1 points to an n-point rule in such a way that the resulting rule is of order 2n + 1. This allows for computing higher-order estimates while re-using the function values of a lower-order estimate. The difference between a Gauss quadrature rule and its Kronrod extension are often used as an estimate of the approximation error.

Gauss–Lobatto rules

Also known as Lobatto quadrature (Abramowitz & Stegun 1972, p. 888), named after Dutch mathematician Rehuel Lobatto. It is similar to Gaussian quadrature with the following differences:

  1. The integration points include the end points of the integration interval.
  2. It is accurate for polynomials up to degree 2n–3, where n is the number of integration points (Quarteroni, Sacco & Saleri 2000).

Lobatto quadrature of function f(x) on interval [−1, 1]:

1 1 f ( x ) d x = 2 n ( n 1 ) [ f ( 1 ) + f ( 1 ) ] + i = 2 n 1 w i f ( x i ) + R n .

Abscissas: xi is the ( i 1 ) st zero of P n 1 ( x ) .

Weights:

w i = 2 n ( n 1 ) [ P n 1 ( x i ) ] 2 , x i ± 1.

Remainder:

R n = n ( n 1 ) 3 2 2 n 1 [ ( n 2 ) ! ] 4 ( 2 n 1 ) [ ( 2 n 2 ) ! ] 3 f ( 2 n 2 ) ( ξ ) , 1 < ξ < 1.

Some of the weights are:

References

Gaussian quadrature Wikipedia