110 CHAPTER 8. NUMERICAL INTEGRATION
If however our integrand varies only slowly over a large interval, then the methods we have
discussed may only slowly converge towards a chosen precision
1
. As an example,
(8.13)
may converge very slowly to a given precision if
is large and/or varies slowly as function
of
at large values. One can obviously rewrite such an integral by changing variables to
resulting in
(8.14)
which has a small integration range and hopefully the number of mesh points needed is not that
large.
However there are cases where no trick may help, and where the time expenditure in evaluat-
ing an integral is of importance. For such cases, we would like to recommend methods based on
Gaussian quadrature. Here one can catch at least two birds with a stone, namely, increased preci-
sion and fewer (less time) mesh points. But it is important that the integrand varies smoothly over
the interval, else we have to revert to splitting the interval into many small subintervals and the
gain achieved may be lost. The mathematical details behind the theory for Gaussian quadrature
formulae is quite terse. If you however are interested in the derivation, we advice you to consult
the text of Stoer and Bulirsch [3], see especially section 3.6. Here we limit ourselves to merely
delineate the philosophy and show examples of practical applications.
The basic idea behind all integration methods is to approximate the integral
(8.15)
where
and are the weights and the chosen mesh points, respectively. In our previous discus-
sion, these mesh points were fixed at the beginning, by choosing a given number of points .
The weigths
resulted then from the integration method we applied. Simpson’s rule, see Eq.
(8.12) would give
(8.16)
for the weights, while the trapezoidal rule resulted in
(8.17)
In general, an integration formula which is based on a Taylor series using
points, will integrate
exactly a polynomial
of degree . That is, the weights can be chosen to satisfy
linear equations, see chapter 3 of Ref. [3]. A greater precision for a given amount of numerical
work can be achieved if we are willing to give up the requirement of equally spaced integration
points. In Gaussian quadrature (hereafter GQ), both the mesh points and the weights are to
1
You could e.g., impose that the integral should not change as function of increasing mesh points beyond the
sixth digit.