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 h2 f'' and we recall the definitions f(x=x1) =f1 , f(x=x-1) =f-1
A better approximation is to use
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
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.