Numerical Analysis

Math 370  MWF 2:30-3:25
Spring 1997  127 Fowler

(04.11.97) \underline{Gaussian Quadrature and Improper Integrals}

N SAMPLE POINTS x_{i} WEIGHTS c_{i}
2 1/\sqrt{3} 1
−1/\sqrt{3}  1
3 \sqrt{3/5} 5/9
0  8/9
−\sqrt{3/5}  5/9

\underline{Example} Use 2-point Gaussian Quadrature to approximate ∫_{−1}^{1} 2x^{2}dx What is the exact value? How accurate do we expect our answer to be?

Use 2-point Gaussian Quadrature to approximate ∫_{1}^{3} 1 − \frac{1}{x^{2}} dx

So, in general, how can we transform the integral on [a,b] to an integral on [-1,1]?

∫_{a}^{b} f(x)dx = ∫_{−1}^{1} N-point Gaussian Quadrature In general, the N-point Gaussian Quadrature rule will have precision 2N −1. The theoretical error looks like

∫_{a}^{b} f(x) dx ≈ ∑_{i=1}^{N} c_{i}f(x_{i}) + \frac{2(N!)^{4}}{(2N + 1)[(2N)!]^{3}} (b − a)^{2N}f^{(2N)}(ξ)

Example Compute the theoretical error bound for our approximation using N = 2 Gaussian Quadra-

ture to find ∫_{1}^{3} 1 − \frac{1}{x^{2}} dx

Compare this theoretical error to the actual error.

Weights and Sample Points It is clear that the x_{1} and x_{2} are the roots of the polynomial x^{2} − 1/3. This is better known as the N = 2 Legendre Polynomial. In fact, in general the x_{i} for the N-point Gaussian Quadrature Rule will be the roots of the N-th degree Legendre Polynomials. The w_{i} are given by

w_{i} = ∫_{−1}^{1} ∏_{j≠i^{j=1}} \frac{x − x_{j}}{x_{i} − x_{j}} , where x_{i} are roots of P_{n}(x)

Legendre Polynomials The Legendre Polynomials P_{n} are a set of orthonormal polynomials on [-1,1]. This means

that P_{N}(x) is a polynomial of degree N and that ∫_{−1}^{1} P_{k}P_{N}dx = 0 for all k less than N. The Polynomials are determined recursively, using:

P_{0}(x) = 1
P_{1}(x) = x − α_{1}
P_{m+1}(x) = xP_{m} − α_{m+1}P_{m}(x) − β_{m+1}P_{m−1}(x)

where α_{m+1} = \frac{∫_{−1}^{1} xP_{m}^{2}dx}{∫_{−1}^{1} P_{m}^{2}dx} and β_{m+1} = \frac{∫_{−1}^{1} xP_{m}P_{m−1}dx}{∫_{−1}^{1} P_{m−1}^{2}dx}

The first few Legendre Polynomials are

P_{0}(x) = 1
P_{1}(x) = x
P_{2}(x) = x^{2} − 1/3
P_{3}(x) = x^{3} − \frac{3}{5}x

Evaluating Improper Integrals Numerically Recall from calculus that an integral is said to be improper when:

Note, that an improper integral of the first kind, ∫_{a}^{∞} f(x) dx can be converted to an improper integral of the second kind by using the transformation t = 1/x. Show this.

So, if we can come up with a scheme for approximating improper integrals of the second kind then we can use this in many different situations.

For the improper integral of the second kind to CONVERGE, it must be able to written as

∫_{a}^{b} f(x) dx = ∫_{a}^{b} \frac{g(x)}{(x − a)^{p}} dx, for 0 < p < 1

with g(x) continuous on [a, b]

If g ∈ C^{5}[a, b] we can construct a 4th degree Taylor Polynomial for g(x) about the point x = a.

P_{4}(x) =

Therefore ∫_{a}^{b} f(x) dx = ∫_{a}^{b} \frac{g(x) − P_{4}(x)}{(x − a)^{p}} + \frac{P_{4}(x)}{(x − a)^{p}} dx

So, we end up having to evaluate two integrals,

∫_{a}^{b} G(x) dx and ∫_{a}^{b} \frac{P_{4}(x)}{(x − a)^{p}} dx

where G(x) = \{ \begin{matrix}\frac{g(x)}{(x − a)^{p}} , & if a < x ≤ b \\ 0, & if x = a \end{matrix}

The integral of G(x) can be approximated very accurately using Simpson’s Method (or Gaussian Quadrature or some other Precision 3 method) since it is C^{4}[a, b], while the other integral is a simple convergent improper integral which can be computed by hand.

NOTE that it doesn’t matter that this improper integral of the second kind blows up at the left endpoint, we can always transform the problem into an associated problem where it blows up at the right endpoint. How do we do that?

\underline{Example}

Find the value of ∫_{−1}^{0} \frac{e^{x}}{\sqrt{x}} dx numerically