next up previous
Next: Numerical Differentiation Up: Approximating the Definite Integral Previous: Richardson Extrapolation

Gaussian Numerical Integration

In the previous sections we discussed methods of approximating the value of the definite integral

displaymath2891

by replacing the function f(x) with a collection of either linear or quadratic interpolating functions on subintervals of [a,b]. It was then a simple matter to integrate each interpolating function across its respective subinterval and find the sum of these values. In this section, we approximate the value of this definite integral by assuming that f(x) can be described reasonably well on [a,b] by a polynomial of a given degree. We then apply a particular numerical method to f(x) that will give the exact value of the definite integral if f(x) is replaced by such a polynomial.

For a function f(x) that is continuous on [a,b], we refer to how well f(x) can be approximated on [a,b] by a polynomial of degree tex2html_wrap_inline2913 by how small we can make the quantity

  equation663

where p(x) is some polynomial of degree tex2html_wrap_inline2913. Note that we are referring to an approximation of f(x) over all of the interval [a,b], and not just at a finite set of points. Different polynomials p(x) and q(x) may yield different values for the expression given in (11), and p(x) is said to be a better approximation of f(x) on [a,b] than q(x) if

displaymath2935

For polynomials of degree tex2html_wrap_inline2913, the one that best approximates f(x) is the one for which (11) is minimized. As N increases we would expect that f(x) can be better approximated by polynomials of degree tex2html_wrap_inline2913.

Let us consider how we might find the exact value of the definite integral

displaymath2947

where p(x) is a polynomial of a given degree. Note that we have changed the interval over which we are integrating to [-1,1]. Later on we shall discuss how this relates to integrals over [a,b]. Let us write this integral as a sum of weighted values of our function p(x) evaluated at a particular set of nodes,

  equation672

We make no initial restrictions on the weights tex2html_wrap_inline2957, but we require that the nodes tex2html_wrap_inline2959 lie in the interval [-1,1]. We can do this for any function as long as the definite integral exists. However, if we specify the weights and the nodes beforehand, then (12) may hold for some functions f(x), but it cannot hold for all functions. For a given positive integer n, we wish to find a particular set of weights and nodes such that (12) will hold for all polynomials of as large a degree as possible. The largest such degree, say N, is called the degree of precision of the integration scheme. Now suppose that f(x) is a function that can then be approximated on [-1,1] by a polynomial p(x) of degree tex2html_wrap_inline2913. Then tex2html_wrap_inline2977 for each value of x in [-1,1]. Since the nodes, tex2html_wrap_inline2983, are each in [-1,1], we have tex2html_wrap_inline2987 for each i. This implies that

displaymath2991

Therefore we have

  equation683

This is known as Gaussian numerical integration. Note that we do not need to know what polynomial can be used to approximate f(x), but just that such a polynomial exists. If we have the values of the weights and the nodes for a given n, then we are able to approximate the definite integral as well as we could if we were to replace f(x) with any polynomial of degree not exceeding the corresponding degree of precision N. Since the polynomial of degree tex2html_wrap_inline2913 that will best approximate f(x) must be included in this set, we have the best possible approximation over all such polynomials. Thus we do not have to spend any time finding a ``best-fitting'' polynomial for each function f(x). Now, there is some work involved in finding the proper weights and nodes for each n, but once we have these they will apply to any function f(x).

Let us consider how to find the values of the weights and the nodes for a given value of n. For convenience, we shall use tex2html_wrap_inline3011 to denote the sum given on the right side of (13) given a function f(x):

displaymath3015

The case n = 1

If n = 1, then (12) becomes

  equation692

We now determine tex2html_wrap_inline3021 and tex2html_wrap_inline3023 so that (14) holds for all polynomials p(x) of as large a degree as possible.

Let tex2html_wrap_inline3027, where tex2html_wrap_inline3029. Then substituting this into (14),

displaymath3031

Integrating and simplifying, we have

displaymath3033

Therefore either tex2html_wrap_inline3035 or tex2html_wrap_inline3037. In either case we can take

displaymath3039

Now let tex2html_wrap_inline3041, where tex2html_wrap_inline3043. When we substitute this, along with tex2html_wrap_inline3037, into (14), we obtain

displaymath3047

Integrating and simplifying,

displaymath3049

Therefore either tex2html_wrap_inline3051 or tex2html_wrap_inline3053. In either case we can take

displaymath3055

Thus we see that (14) holds for all polynomials p(x) of degree 1 or less if it is of the form

  equation702

Since all weights and nodes have been determined at this point, we have, for an arbitrary function f(x),

displaymath3063

Note that (15) does not hold, in general, for polynomials p(x) of degree 2 or greater, as we can illustrate with the example tex2html_wrap_inline3069. In this case we have

displaymath3071

whereas

displaymath3073

Therefore since (15) holds for all polynomials p(x) of degree 1 or less, but does not hold for all polynomials of degree 2, the degree of precision of (15) is 1.

Example 20 Let us now consider how to apply Gaussian numerical integration with n = 1 to approximate the value of the definite integral

displaymath3079

The value of this approximation will be the value of tex2html_wrap_inline3081 for the function f(x) = 1/(x+3). We have

displaymath3085

yielding an error of .026480514 (to nine decimal places). tex2html_wrap_inline2195

Example 21 Let us now approximate the value of

displaymath3091

by applying Gaussian numerical integration with n = 1.

By (13) we have

displaymath3095

To nine decimal places, the error of this approximation is -.317058030. tex2html_wrap_inline2195

The case n = 2

For n = 2, (12) becomes

  equation724

We must now determine the values of four unknowns, tex2html_wrap_inline3105 and tex2html_wrap_inline3107, so that (16) will hold for all polynomials p(x) of as large a degree as possible.

We proceed much as we did for the case of n = 1 to find conditions on the four unknowns that will allow us to determine their values. However we shall not detail the work for this case. Requiring (16) to hold for all polynomials of degree 0, implies

  equation730

This result, combined with the requirement that (16) holds for all polynomials of degree 1, implies that

  equation734

If (16) holds for all polynomials of degree 2 or less, then

  equation738

Finally, (17), (18), and (19), combined with (16) being true for all polynomials of degree 3, yields

  equation747

Thus we have four equations, (17), (18), (19), and (20), involving four unknowns, tex2html_wrap_inline3021, tex2html_wrap_inline3115, tex2html_wrap_inline3023, and tex2html_wrap_inline3107. We can combine this system to obtain the values

displaymath3121

for the weights, and

displaymath3123

for the nodes. Therefore, (16) holds for all polynomials of degree 3 or less if it is of the form

  equation757

At this point we can also write, for an arbitrary function f(x),

displaymath3127

In general, polynomials of degree 4 or greater do not satisfy (21). Thus (21) has degree of precision 3.

Example 22 Now we shall apply Gaussian numerical integration with n = 2 to approximate the value of

displaymath3079

The value of this approximation is the value of tex2html_wrap_inline3133 for the function f(x) = 1/(x+3). We have

displaymath3137

Therefore

displaymath3139

with an error of .000839488, to nine decimal places. tex2html_wrap_inline2195

Example 23 Applying Gaussian numerical integration with n = 2 to approximate the value of

displaymath3091

yields

displaymath3149

To nine decimal places, the error of this approximation is .007118314. tex2html_wrap_inline2195

The case tex2html_wrap_inline3155

We continue the method that we applied to the cases n = 1 and 2, for arbitrary n. In doing so, we will obtain 2 n equations of the 2 n unknowns tex2html_wrap_inline2957 and tex2html_wrap_inline2959. Upon solving for these, we will have an approximation scheme that has degree of precision 2n - 1.

For the case n = 3 we have the values

displaymath3175

for the weights, and for the nodes

displaymath3177

These values are exact, and generally the values of the weights and nodes are given in decimal expansion instead of an exact form. Table 1 provides numerical values for the weights and the nodes for tex2html_wrap_inline2243. Values of the weights and nodes for larger values of n can be found in many standard books of mathematical tables.

   table807
Table 1: The weights and nodes for Gaussian numerical integration corresponding to tex2html_wrap_inline1943.

Example 24 Applying Gaussian numerical integration with n = 3, the approximate value of the definite integral

displaymath3189

is given by

displaymath3191

To nine decimal places, the error of this approximation is -.020820931. tex2html_wrap_inline2195

Example 25 Let us apply Gaussian numerical integration with n = 5 to approximate the value of

displaymath3079

In this case our function f(x) = 1/(x+3). Rounded to nine decimal places, f(x) takes on the following values at each of the nodes:

displaymath3205

The value of tex2html_wrap_inline3207 is then given by

eqnarray847

Therefore

displaymath3209

with an error of -.000000023. tex2html_wrap_inline2195

Example 26 Now we shall approximate the value of

displaymath3091

using Gaussian numerical integration for the values n = 1,2,3,4,5. We form a table to provide nine decimal place values of tex2html_wrap_inline3011 along with the error for each value of n.

displaymath3223

The results that we have gotten in this section so far only relate to definite integrals over the interval [-1,1]. We now consider the issue of how to relate these results with definite integrals over arbitrary finite intervals [a,b].

Let a and b each be finite, tex2html_wrap_inline3233. By the change of variables

displaymath3235

so that

displaymath3237

we can rewrite a definite integral over [a,b] according to

displaymath3241

Therefore we have a definite integral over [-1,1], the value of which can then be approximated using the method of Gaussian numerical integration.

Example 27 Let us now use Gaussian numerical integration with n = 2 to approximate the value of the definite integral

displaymath3247

Making the change of variables

displaymath3249

we obtain

displaymath3251

Here we approximate the definite integral

displaymath3253

taking the function

displaymath3255

To nine decimal places

displaymath3257

Therefore

displaymath3259

and we have

displaymath3261

Example 28 We shall now approximate the value of

displaymath3263

using Gaussian numerical integration with n = 4.

The change of variables

displaymath3267

allows us to write

displaymath3269

Here we must determine

displaymath3271

with our function

displaymath3273

Rounded to nine decimal places, f(t) takes on the following values at each of the nodes

displaymath3277

The value of tex2html_wrap_inline3279 is then given by

eqnarray917

Therefore

displaymath3281

giving an error of -.037577158. tex2html_wrap_inline2195

We have not, as yet, made mention of how to approximate the error, tex2html_wrap_inline2323, of the approximation of the definite integral

displaymath3289

by using the method of Gaussian numerical integration for some n. This is due to the fact that to obtain an actual bound on the error requires a knowledge of materials that are outside of what we have been presenting. However we can give a sense of what is needed in order to find a bound on the error.

Theorem 1.3 Suppose that f(x) is continuous on [-1,1]. Then for n a positive integer,

displaymath3299

where

displaymath3301

with weights tex2html_wrap_inline3303 and nodes tex2html_wrap_inline2983 corresponding to the Gaussian numerical approximation for n, and the error tex2html_wrap_inline2323 is bounded according to

displaymath3311

with

displaymath3313

As the theorem states, if we can find the value of tex2html_wrap_inline3315, as given in the theorem, then we can find a bound on the error generated by the Gaussian numerical integration approximation scheme. However, it is the method of finding the value of tex2html_wrap_inline3315, or even an accurate approximation of the value of tex2html_wrap_inline3315, that is beyond our means. We can obtain an upper bound for tex2html_wrap_inline3315 by selecting any polynomial p(x) of degree at most 2 n - 1. The bound would then be given by

displaymath3327


next up previous
Next: Numerical Differentiation Up: Approximating the Definite Integral Previous: Richardson Extrapolation