The formula in the above equation can be written in a
compact form by defining
. What this means is
the interval
is divided into N equal parts of length
and
the integral in each part is approximated by
times the value of
the function at the midpoint ( the first equation ) or the average of
the function at two ends of the part ( the second equation ). These
formulae are often called as extended midpoint rule and extended
trapizoidal rule respectively. The meaning of these terms is
obvious. The formula is exact in the limit
.
On a computer, however, we cannot take the limit
and we have to estimate the integral for some reasonably large
value of N. This is depicted in Figure below. In this figure the
trapizoidal and midpoint rules are shown by dashed and dotted lines
respectively.
In fact, there is an exact expression for the integral in terms of the sum given above plus correction terms which depend on the higher derivatives of the integrand. :
![]() |
|||
![]() |
(14) |
where
are the Bernaulli numbers. This is the Euler-Maclaurin
summation formula for the integration. So, in principle, if one knows
all the deriatives of the function, one has an analytic expression for
the integral. Usually, this is not the case so one has to limit
the summation to finite number of derivatives. In fact, most of the
time we may not know any derivatives of the integrand at the end
points.
Clearly, the correction terms
go to zero ( provided all the higher derivatives of the function are
finite ) in the limit
going to zero. We can
take advantage of the formula by computing the first term for two or
more values of N and
use the result to eliminate some of the leading terms of the
correction series. In particular, if we compute the integral for N and
2N intervals then it is straight forward to show that
![]() |
(15) |
So, with the two computations we have got a new formula which is
expected to be much more accurate. This is the extended Simpson's
rule. We can write it in a more familiar form by defining
,
![]() |
(16) |
The trapizoidal and Simpson rules are called closed formulae because the end-points are included in the formula. The midpoint rule is an open formula. Sometimes open formula is useful if the integrand has an integrable singularity at the end-point(s). The closed formula does not work in such cases because the function is singular at the end point(s).
We can obtain a formula similar ( in spirit ) to the Simpson formula from the midpoint rule. The trick is to triple the number of points here since by doubling we cannot get advantage of previous computations. We then have
![]() |
(17) |
where
is the estimate of the integral using extended midpoint
rule;
![]() |
(18) |
There are a number of other integration formulae ( both open and closed type ) using intervals of equal spacing. We shall not be considering them as they are more complicated to program and they do not seem to have much advantage over trapizoidal, midpoint or Simpson rules described above.
Given an integral to be done on computer, one is not sure about the number of points to be used in the calculation. In that case, one can use certain number of integration points and check the accuracy by doubling the number of points. Note that, if one uses trapizoidal rule, half of the points at which the function is needed for second calculation are already computed in the first step. Using the two results, we have a refined estimate of the answer ( which is actually the Simpson rule ). One should have the difference between the second computation and the refined estimate to be tolerably small. If it is not, one needs to double the number of points again and repeat the procedure. One can have an integration subroutine using this algorithm.