Gaussian quadrature explained

In numerical analysis, an -point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree or less by a suitable choice of the nodes and weights for .

The modern formulation using orthogonal polynomials was developed by Carl Gustav Jacobi in 1826. The most common domain of integration for such a rule is taken as, so the rule is stated as\int_^1 f(x)\,dx \approx \sum_^n w_i f(x_i),

which is exact for polynomials of degree or less. This exact rule is known as the Gauss–Legendre quadrature rule. The quadrature rule will only be an accurate approximation to the integral above if is well-approximated by a polynomial of degree or less on .

The Gauss–Legendre quadrature rule is not typically used for integrable functions with endpoint singularities. Instead, if the integrand can be written as

f(x) = \left(1 - x\right)^\alpha \left(1 + x\right)^\beta g(x),\quad \alpha,\beta > -1,

where is well-approximated by a low-degree polynomial, then alternative nodes and weights will usually give more accurate quadrature rules. These are known as Gauss–Jacobi quadrature rules, i.e.,

\int_^1 f(x)\,dx = \int_^1 \left(1 - x\right)^\alpha \left(1 + x\right)^\beta g(x)\,dx \approx \sum_^n w_i' g\left(x_i'\right).

Common weights include \frac (Chebyshev–Gauss) and \sqrt. One may also want to integrate over semi-infinite (Gauss–Laguerre quadrature) and infinite intervals (Gauss–Hermite quadrature).

It can be shown (see Press et al., or Stoer and Bulirsch) that the quadrature nodes are the roots of a polynomial belonging to a class of orthogonal polynomials (the class orthogonal with respect to a weighted inner-product). This is a key observation for computing Gauss quadrature nodes and weights.

Gauss–Legendre quadrature

For the simplest integration problem stated above, i.e., is well-approximated by polynomials on

[-1,1]

, the associated orthogonal polynomials are Legendre polynomials, denoted by . With the -th polynomial normalized to give, the -th Gauss node,, is the -th root of and the weights are given by the formula w_i = \frac.

Some low-order quadrature rules are tabulated below (over interval, see the section below for other intervals).

Number of points, Points, Weights,
102
2
\pm1
\sqrt{3
}
±0.57735...1
30
8
9
0.888889...
\pm\sqrt{3
5
}
±0.774597...
5
9
0.555556...
4
\pm\sqrt{3
7

-

2\sqrt{
7
6
5
}}
±0.339981...
18+\sqrt{30
}
0.652145...
\pm\sqrt{3
7

+

2\sqrt{
7
6
5
}}
±0.861136...
18-\sqrt{30
}
0.347855...
50
128
225
0.568889...
\pm1
3

\sqrt{5-2\sqrt{

10
7
}}
±0.538469...
322+13\sqrt{70
}
0.478629...
\pm1
3

\sqrt{5+2\sqrt{

10
7
}}
±0.90618...
322-13\sqrt{70
}
0.236927...

Change of interval

An integral over must be changed into an integral over before applying the Gaussian quadrature rule. This change of interval can be done in the following way:\int_a^b f(x)\,dx = \int_^1 f\left(\frac\xi + \frac\right)\,\fracd\xi

with

dx
d\xi

=

b-a
2

Applying the

n

point Gaussian quadrature

(\xi,w)

rule then results in the following approximation:\int_a^b f(x)\,dx \approx \frac \sum_^n w_i f\left(\frac\xi_i + \frac\right).

Example of two-point Gauss quadrature rule

Use the two-point Gauss quadrature rule to approximate the distance in meters covered by a rocket from

t=8s

to

t=30s,

as given bys = \int_^

Change the limits so that one can use the weights and abscissae given in Table 1. Also, find the absolute relative true error. The true value is given as 11061.34 m.

Solution

First, changing the limits of integration from

\left[8,30\right]

to

\left[-1,1\right]

gives

\begin\int_^ &= \frac \int_^ \\&= 11\int_^\end

Next, get the weighting factors and function argument values from Table 1 for the two-point rule,

c1=1.000000000

x1=-0.577350269

c2=1.000000000

x2=0.577350269

Now we can use the Gauss quadrature formula \begin11\int_^ & \approx 11\left[c_1 f\left(11 x_1 + 19 \right) + c_2 f\left(11 x_2 + 19 \right) \right] \\&= 11\left[f\left(11(- 0.5773503) + 19 \right) + f\left(11(0.5773503) + 19 \right) \right] \\&= 11\left[f(12.64915) + f(25.35085) \right] \\&= 11\left[(296.8317) + (708.4811) \right] \\&= 11058.44\endsince \beginf(12.64915) & = 2000\ln\left[\frac{140000}{140000 - 2100(12.64915)} \right] - 9.8(12.64915) \\&= 296.8317\end \beginf(25.35085) & = 2000\ln\left[\frac{140000}{140000 - 2100(25.35085)} \right] - 9.8(25.35085) \\&= 708.4811\end

Given that the true value is 11061.34 m, the absolute relative true error,

\left|\varepsilont\right|

is \left| \varepsilon_ \right| = \left| \frac \right| \times 100\% = 0.0262\%

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 . That is, the problem is to calculate \int_a^b \omega(x)\,f(x)\,dx for some choices of,, and . For,, and, 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).

IntervalOrthogonal polynomialsA & SFor more information, see ...
25.4.29

\left(1-x\right)\alpha\left(1+x\right)\beta,\alpha,\beta>-1

25.4.33 Gauss–Jacobi quadrature
1
\sqrt{1-x2
}
Chebyshev polynomials (first kind) 25.4.38 Chebyshev–Gauss quadrature

\sqrt{1-x2}

Chebyshev polynomials (second kind) 25.4.40 Chebyshev–Gauss quadrature

e-x

25.4.45 Gauss–Laguerre quadrature

x\alphae-x,\alpha>-1

Gauss–Laguerre quadrature
-x2
e

25.4.46 Gauss–Hermite quadrature

Fundamental theorem

Let be a nontrivial polynomial of degree such that\int_a^b \omega(x) \, x^k p_n(x) \, dx = 0, \quad \text k = 0, 1, \ldots, n - 1.

Note that this will be true for all the orthogonal polynomials above, because each is constructed to be orthogonal to the other polynomials for, and is in the span of that set.

If we pick the nodes to be the zeros of, then there exist weights which make the Gaussian quadrature computed integral exact for all polynomials of degree or less. Furthermore, all these nodes will lie in the open interval .

To prove the first part of this claim, let be any polynomial of degree or less. Divide it by the orthogonal polynomial to get h(x) = p_n(x) \, q(x) + r(x). where is the quotient, of degree or less (because the sum of its degree and that of the divisor must equal that of the dividend), and is the remainder, also of degree or less (because the degree of the remainder is always less than that of the divisor). Since is by assumption orthogonal to all monomials of degree less than, it must be orthogonal to the quotient . Therefore \int_a^b \omega(x)\,h(x)\,dx = \int_a^b \omega(x)\,\big(\, p_n(x) q(x) + r(x) \, \big)\,dx = \int_a^b \omega(x)\,r(x)\,dx.

Since the remainder is of degree or less, we can interpolate it exactly using interpolation points with Lagrange polynomials, where l_i(x) = \prod _ \frac.

We have r(x) = \sum_^n l_i(x) \, r(x_i).

Then its integral will equal \int_a^b \omega(x)\,r(x)\,dx = \int_a^b \omega(x) \, \sum_^n l_i(x) \, r(x_i) \, dx = \sum_^n \, r(x_i) \, \int_a^b \omega(x) \, l_i(x) \, dx = \sum_^n \, r(x_i) \, w_i,

where, the weight associated with the node, is defined to equal the weighted integral of (see below for other formulas for the weights). But all the are roots of, so the division formula above tells us that h(x_i) = p_n(x_i) \, q(x_i) + r(x_i) = r(x_i), for all . Thus we finally have \int_a^b \omega(x)\,h(x)\,dx = \int_a^b \omega(x) \, r(x) \, dx = \sum_^n w_i \, r(x_i) = \sum_^n w_i \, h(x_i).

This proves that for any polynomial of degree or less, its integral is given exactly by the Gaussian quadrature sum.

To prove the second part of the claim, consider the factored form of the polynomial . Any complex conjugate roots will yield a quadratic factor that is either strictly positive or strictly negative over the entire real line. Any factors for roots outside the interval from to will not change sign over that interval. Finally, for factors corresponding to roots inside the interval from to that are of odd multiplicity, multiply by one more factor to make a new polynomial p_n(x) \, \prod_i (x - x_i).

This polynomial cannot change sign over the interval from to because all its roots there are now of even multiplicity. So the integral \int_a^b p_n(x) \, \left(\prod_i (x - x_i) \right) \, \omega(x) \, dx \ne 0, since the weight function is always non-negative. But is orthogonal to all polynomials of degree or less, so the degree of the product \prod_i (x - x_i) must be at least . Therefore has distinct roots, all real, in the interval from to .

General formula for the weights

The weights can be expressed as

where

ak

is the coefficient of

xk

in

pk(x)

. To prove this, note that using Lagrange interpolation one can express in terms of

r(xi)

asr(x) = \sum_^ r(x_) \prod_\fracbecause has degree less than and is thus fixed by the values it attains at different points. Multiplying both sides by and integrating from to yields\int_^\omega(x)r(x)dx = \sum_^ r(x_) \int_^\omega(x)\prod_ \fracdx

The weights are thus given byw_ = \int_^\omega(x)\prod_\fracdx

This integral expression for

wi

can be expressed in terms of the orthogonal polynomials

pn(x)

and

pn-1(x)

as follows.

We can write \prod_ \left(x-x_\right) = \frac = \frac

where

an

is the coefficient of

xn

in

pn(x)

. Taking the limit of to

xi

yields using L'Hôpital's rule \prod_ \left(x_-x_\right) = \frac

We can thus write the integral expression for the weights as

In the integrand, writing\frac = \frac + \left(\frac\right)^ \frac

yields\int_a^b\omega(x)\fracdx = x_i^k \int_^\omega(x)\fracdx

provided

k\leqn

, because\fracis a polynomial of degree which is then orthogonal to

pn(x)

. So, if is a polynomial of at most nth degree we have\int_^\omega(x)\frac dx = \frac \int_^ \omega(x)\fracdx

We can evaluate the integral on the right hand side for

q(x)=pn-1(x)

as follows. Because
pn(x)
x-xi
is a polynomial of degree, we have\frac = a_x^ + s(x)where is a polynomial of degree

n-2

. Since is orthogonal to

pn-1(x)

we have\int_^\omega(x)\fracdx=\frac \int_^\omega(x)p_(x)x^dx

We can then writex^ = \left(x^ - \frac\right) + \frac

The term in the brackets is a polynomial of degree

n-2

, which is therefore orthogonal to

pn-1(x)

. The integral can thus be written as\int_^\omega(x)\fracdx = \frac \int_^\omega(x) p_(x)^ dx

According to equation, the weights are obtained by dividing this by

p'n(xi)

and that yields the expression in equation .

wi

can also be expressed in terms of the orthogonal polynomials

pn(x)

and now

pn+1(x)

. In the 3-term recurrence relation

pn+1(xi)=(a)pn(xi)+(b)pn-1(xi)

the term with

pn(xi)

vanishes, so

pn-1(xi)

in Eq. (1) can be replaced by \frac p_ \left(x_i\right).

Proof that the weights are positive

Consider the following polynomial of degree

2n-2

f(x) = \prod_\fracwhere, as above, the are the roots of the polynomial

pn(x)

. Clearly

f(xj)=\deltaij

. Since the degree of

f(x)

is less than

2n-1

, the Gaussian quadrature formula involving the weights and nodes obtained from

pn(x)

applies. Since

f(xj)=0

for not equal to, we have\int_^\omega(x)f(x)dx=\sum_^w_f(x_) = \sum_^ \delta_ w_j = w_ > 0.

Since both

\omega(x)

and

f(x)

are non-negative functions, it follows that

wi>0

.

Computation of Gaussian quadrature rules

There are many algorithms for computing the nodes and weights of Gaussian quadrature rules. The most popular are the Golub-Welsch algorithm requiring operations, Newton's method for solving

pn(x)=0

using the three-term recurrence for evaluation requiring operations, and asymptotic formulas for large n requiring operations.

Recurrence relation

Orthogonal polynomials

pr

with

(pr,ps)=0

for

r\nes

for a scalar product

(,)

, degree

(pr)=r

and leading coefficient one (i.e. monic orthogonal polynomials) satisfy the recurrence relationp_(x) = (x - a_) p_r(x) - a_ p_(x) \cdots - a_p_0(x)

and scalar product defined(f(x),g(x))=\int_a^b\omega(x)f(x)g(x)dx

for

r=0,1,\ldots,n-1

where is the maximal degree which can be taken to be infinity, and where a_ = \frac. First of all, the polynomials defined by the recurrence relation starting with

p0(x)=1

have leading coefficient one and correct degree. Given the starting point by

p0

, the orthogonality of

pr

can be shown by induction. For

r=s=0

one has(p_1,p_0) = (x-a_) (p_0,p_0) = (xp_0,p_0) - a_(p_0,p_0) = (xp_0,p_0) - (xp_0,p_0) = 0.

Now if

p0,p1,\ldots,pr

are orthogonal, then also

pr+1

, because in(p_, p_s) = (xp_r, p_s) - a_(p_r, p_s) - a_(p_, p_s)\cdots - a_(p_0, p_s)all scalar products vanish except for the first one and the one where

ps

meets the same orthogonal polynomial. Therefore,(p_,p_s) = (xp_r,p_s) - a_(p_s,p_s) = (xp_r,p_s)-(xp_r,p_s) = 0.

However, if the scalar product satisfies

(xf,g)=(f,xg)

(which is the case for Gaussian quadrature), the recurrence relation reduces to a three-term recurrence relation: For

s<r-1,xps

is a polynomial of degree less than or equal to . On the other hand,

pr

is orthogonal to every polynomial of degree less than or equal to . Therefore, one has

(xpr,ps)=(pr,xps)=0

and

ar,s=0

for . The recurrence relation then simplifies top_(x) = (x-a_) p_r(x) - a_ p_(x)

orp_(x) = (x-a_r) p_r(x) - b_r p_(x)

(with the convention

p-1(x)\equiv0

) wherea_r := \frac, \qquad b_r := \frac = \frac

(the last because of

(xpr,pr-1)=(pr,xpr-1)=(pr,pr)

, since

xpr-1

differs from

pr

by a degree less than).

The Golub-Welsch algorithm

The three-term recurrence relation can be written in matrix form

J\tilde{P}=x\tilde{P}-pn(x)en

where

\tilde{P}=\begin{bmatrix}p0(x)&p1(x)&&pn-1(x)\end{bmatrix}T

,

en

is the

n

th standard basis vector, i.e.,

en=\begin{bmatrix}0&&0&1\end{bmatrix}T

, and is the following tridiagonal matrix, called the Jacobi matrix:\mathbf = \begin a_0 & 1 & 0 & \cdots & 0 \\ b_1 & a_1 & 1 & \ddots & \vdots \\ 0 & b_2 & \ddots & \ddots & 0 \\ \vdots & \ddots & \ddots & a_ & 1 \\ 0 & \cdots & 0 & b_ & a_\end.

The zeros

xj

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

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

l{J}

with elements\begin \mathcal_ = J_ &= a_ & k &= 1,2,\ldots,n \\[2.1ex] \mathcal_ = \mathcal_ = \sqrt &= \sqrt & k &= \hphantom2,\ldots,n.\end

That is,

\mathcal = \begin a_0 & \sqrt & 0 & \cdots & 0 \\\sqrt & a_1 & \sqrt & \ddots & \vdots \\ 0 & \sqrt & \ddots & \ddots & 0 \\ \vdots & \ddots & \ddots & a_ & \sqrt \\ 0 & \cdots & 0 & \sqrt & a_\end.

and

l{J}

are similar matrices and therefore have the same eigenvalues (the nodes). The weights can be computed from the corresponding eigenvectors: If

\phi(j)

is a normalized eigenvector (i.e., an eigenvector with euclidean norm equal to one) associated with the eigenvalue, the corresponding weight can be computed from the first component of this eigenvector, namely:w_j = \mu_0 \left(\phi_1^\right)^2

where

\mu0

is the integral of the weight function\mu_0 = \int_a^b \omega(x) dx.

See, for instance, for further details.

Error estimates

The error of a Gaussian quadrature rule can be stated as follows. For an integrand which has continuous derivatives, \int_a^b \omega(x)\,f(x)\,dx - \sum_^n w_i\,f(x_i) = \frac \, (p_n, p_n) for some in, where is the monic (i.e. the leading coefficient is) orthogonal polynomial of degree and where (f,g) = \int_a^b \omega(x) f(x) g(x) \, dx.

In the important special case of, we have the error estimate \frac f^ (\xi), \qquad a < \xi < b.

Stoer and Bulirsch remark that this error estimate is inconvenient in practice, since it may be difficult to estimate the order 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

See main article: Gauss–Kronrod quadrature formula.

If the interval 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 points to an -point rule in such a way that the resulting rule is of order . 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 is often used as an estimate of the approximation error.

Gauss–Lobatto rules

Also known as Lobatto quadrature, 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, where is the number of integration points.

Lobatto quadrature of function on interval :\int_^1 = \frac [f(1) + f(-1)] + \sum_^ + R_n.

Abscissas: is the

(i-1)

st zero of

P'n-1(x)

, here

Pm(x)

denotes the standard Legendre polynomial of -th degree and the dash denotes the derivative.

Weights:w_i = \frac, \qquad x_i \ne \pm 1.

Remainder:R_n = \frac f^(\xi), \qquad -1 < \xi < 1.

Some of the weights are:

Number of points, nPoints, Weights,

3

0

4
3

\pm1

1
3

4

\pm\sqrt{

1
5
}
5
6

\pm1

1
6

5

0

32
45
\pm\sqrt{3
7
}
49
90

\pm1

1
10

6

\pm\sqrt{1-
3
2\sqrt{7
}}
14+\sqrt{7
}
\pm\sqrt{1
3

+

2\sqrt{7
}}
14-\sqrt{7
}

\pm1

1
15

7

0

256
525
\pm\sqrt{5-
11
2\sqrt{
11
5
3
}}
124+7\sqrt{15
}
\pm\sqrt{5
11

+

2\sqrt{
11
5
3
}}
124-7\sqrt{15
}

\pm1

1
21

An adaptive variant of this algorithm with 2 interior nodes is found in GNU Octave and MATLAB as quadl and integrate.

References

Bibliography

External links