27.4 NUMERICAL INTEGRATION
x
y=f(x)
y=c
x=ax=b
Figure 27.5 A simple rectangular figure enclosing the area (shown shaded)
which is equal to
∫b
af(x)dx.
and thex-axis in the rangea≤x≤b. It may not be possible to do this
analytically, but if, as shown in figure 27.5, we can enclose the curve in a simple
figure whose area can be found trivially then the ratio of the required (shaded)
area to that of the bounding figure,c(b−a), is the same as the probability that a
randomly selected point inside the boundary will lie below the line.
In order to accommodate cases in whichf(x) can be negative in part of the
x-range, we treat a slightly more general case. Suppose that, fora≤x≤b,f(x)
is bounded and known to lie in the rangeA≤f(x)≤B; then the transformation
z=
x−a
b−a
will reduce the integral
∫b
af(x)dxto the form
A(b−a)+(B−A)(b−a)
∫ 1
0
h(z)dz, (27.52)
where
h(z)=
1
B−A
[f((b−a)z+a)−A].
In this formzlies in the range 0≤z≤1andh(z) lies in the range 0≤h(z)≤1,
i.e. both are suitable for simulation using the standard random-number generator.
It should be noted that, for an efficient estimation, the boundsAandBshould
be drawn as tightly as possible –preferably, but not necessarily, they should be
equal to the minimum and maximum values offin the range. The reason for
this is that random numbers corresponding to values whichf(x) cannot reach
add nothing to the estimation but do increase its variance.
It only remains to estimate the final integral on the RHS of equation (27.52).
This we do by selecting pairs of random numbers,ξ 1 andξ 2 , and testing whether