In the previous sections we discussed methods of approximating the value of the definite integral
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
by how small we can make the quantity
where p(x) is some polynomial of degree
. 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
For polynomials of degree
, 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
.
Let us consider how we might find the exact value of the definite integral
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,
We make no initial restrictions on the weights
,
but we require that the nodes
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
. Then
for each value of
x in [-1,1]. Since the nodes,
, are each in [-1,1], we have
for each i. This implies that
Therefore we have
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
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
to denote
the sum given on the right side of (13) given a function
f(x):
The case n = 1
If n = 1, then (12) becomes
We now determine
and
so that (14) holds for all
polynomials p(x) of as large a degree as possible.
Let
, where
. Then substituting this into
(14),
Integrating and simplifying, we have
Therefore either
or
. In either case we can take
Now let
, where
. When we
substitute this, along with
, into (14), we obtain
Integrating and simplifying,
Therefore either
or
. In either case we can take
Thus we see that (14) holds for all polynomials p(x) of degree 1 or less if it is of the form
Since all weights and nodes have been determined at this point, we have, for an arbitrary function f(x),
Note that (15) does not hold, in general, for polynomials
p(x) of degree 2 or greater, as we can illustrate with the example
. In this case we have
whereas
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
The value of this approximation will be the value of
for the
function f(x) = 1/(x+3). We have
yielding an error of .026480514 (to nine decimal places).
Example 21 Let us now approximate the value of
by applying Gaussian numerical integration with n = 1.
By (13) we have
To nine decimal places, the error of this approximation is
-.317058030.
The case n = 2
For n = 2, (12) becomes
We must now determine the values of four unknowns,
and
, 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
This result, combined with the requirement that (16) holds for all polynomials of degree 1, implies that
If (16) holds for all polynomials of degree 2 or less, then
Finally, (17), (18), and (19), combined with (16) being true for all polynomials of degree 3, yields
Thus we have four equations, (17), (18),
(19), and (20), involving four unknowns,
,
,
, and
. We can combine this system to obtain the
values
for the weights, and
for the nodes. Therefore, (16) holds for all polynomials of degree 3 or less if it is of the form
At this point we can also write, for an arbitrary function f(x),
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
The value of this approximation is the value of
for the
function f(x) = 1/(x+3). We have
Therefore
with an error of .000839488, to nine decimal places.
Example 23 Applying Gaussian numerical integration with n = 2 to approximate the value of
yields
To nine decimal places, the error of this approximation is
.007118314.
The case
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
and
. 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
for the weights, and for the nodes
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
. Values of the weights and nodes
for larger values of n can be found in many standard books of
mathematical tables.
Table 1: The weights and nodes for Gaussian numerical integration
corresponding to
.
Example 24 Applying Gaussian numerical integration with n = 3, the approximate value of the definite integral
is given by
To nine decimal places, the error of this approximation is
-.020820931.
Example 25 Let us apply Gaussian numerical integration with n = 5 to approximate the value of
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:
The value of
is then given by
Therefore
with an error of -.000000023.
Example 26 Now we shall approximate the value of
using Gaussian numerical integration for the values n = 1,2,3,4,5.
We form a table to provide nine decimal place values of
along
with the error for each value of n.
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,
. By the change of variables
so that
we can rewrite a definite integral over [a,b] according to
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
Making the change of variables
we obtain
Here we approximate the definite integral
taking the function
To nine decimal places
Therefore
and we have
Example 28 We shall now approximate the value of
using Gaussian numerical integration with n = 4.
The change of variables
allows us to write
Here we must determine
with our function
Rounded to nine decimal places, f(t) takes on the following values at each of the nodes
The value of
is then given by
Therefore
giving an error of -.037577158.
We have not, as yet, made mention of how to approximate the error,
, of the approximation of the definite integral
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,
where
with weights
and nodes
corresponding to the Gaussian
numerical approximation for n, and the error
is bounded
according to
with
As the theorem states, if we can find the value of
, 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
, or even an accurate
approximation of the value of
, that is beyond our means. We can
obtain an upper bound for
by selecting any polynomial p(x)
of degree at most 2 n - 1. The bound would then be given by