## NUMERICAL QUADRATURE

We again start with a sum

And draw this function as follows:

where * h * is the lattice spacing.
We now select two points * a * and * b *,
separated by an even number of lattice spacings, *
N*,
where * a * is less than * b *: i.e. * N=(b-a)/h*.
It is sufficient to derive a formula for the integral from * -h *
to * h * since we can repeat this many times to get the integral from
from * a * to * b *. (The interval * a * to * b *
is made up of intervals from * a * to * a +2h *,*
a+2h * to * a +4h *,.....,* b-2h * to * b *.) The idea is
then to
approximate * f(x)* over each interval by some function that can be
integrated exactly.

We carry this scheme out by considering the intervals [*-h,0*] and [*0,h*], assume * f(x)
* to be linear in both, and obtain, by the trapezoidal rule,

The error here is * h*^{2 }f'' and we recall the definitions
* f(x=x*_{1})
=f_{1} ,
* f(x=x*_{-1})
=f_{-1}

A better approximation is to use

- the Taylor series as given in Equation
1 of the page
on differentiation,
- the two point finite difference approximation for
* f' *, and
- the expression for
* f''* from the bottom
of the differentiation page to get

which is integrated to give

This is Simpson's Rule, and we can combine the intervals to give

Example:
chap1b.f
This routine evaluates the integral

for the value of * N=1/h* input with the combined Simpson's
rule algorithm. Compile and run this program with different *h*
selections. How do the errors behave as *h* is increased?
Do they increase after some point? (Answer: no as there is not the
subtraction as in the case of differentiation.)
How can we improve this? Smaller *h* is one way, but
there are better ways to approximate the functions, e.g. with cubic or
quartic polynomials leading to Simpson's 3/8 and
Bode's rule, which have more terms for each interval.
Table 1.3 of Koonin shows the comparative results.
* ** ** ** ** *

We will return to quadrature in
Lecture 6,
after learning about special functions.

Back to
Lecture 3 page.
* ** ** ** ** ** ** *