NUMERICAL METHODS
h(ξ 1 )>ξ 2. The fraction of times that this inequality is satisfied estimates the value
of the integral (without the scaling factors (B−A)(b−a)) since the expectation
value of this fraction is the ratio of the area below the curvey=h(z)tothearea
of a unit square.
To illustrate the evaluation of multiple integrals using Monte Carlo techniques,
consider the relatively elementary problem of finding the volume of an irregular
solid bounded by planes, say an octahedron. In order to keep the description
brief, but at the same time illustrate the general principles involved, let us suppose
that the octahedron has two vertices on each of the three Cartesian axes, one on
either side of the origin for each axis. Denote those on thex-axis byx 1 (<0) and
x 2 (>0), and similarly for they-andz-axes. Then the whole of the octahedron
can be enclosed by the rectangular parallelepiped
x 1 ≤x≤x 2 ,y 1 ≤y≤y 2 ,z 1 ≤z≤z 2.
Any point in the octahedron lies inside or on the parallelepiped, but any point
in the parallelepiped may or may not lie inside the octahedron.
The equation of the plane containing the three vertex points (xi, 0 ,0),(0,yj,0)
and (0, 0 ,zk)is
x
xi
+
y
yj
+
z
zk
=1 fori, j, k=1, 2 , (27.53)
and the condition that any general point (x, y, z) lies on the same side of the
plane as the origin is that
x
xi
+
y
yj
+
z
zk
− 1 ≤ 0. (27.54)
For the point to be inside or on the octahedron, equation (27.54) must therefore
be satisfied forall eightof the sets ofi, jandkgiven in (27.53).
Thus an estimate of the volume of the octahedron can be made by generating
random numbersξfrom the usual uniform distribution and then using them in
sets of three, according to the following scheme.
With integermlabelling themth set of three random numbers, calculate
x=x 1 +ξ 3 m− 2 (x 2 −x 1 ),
y=y 1 +ξ 3 m− 1 (y 2 −y 1 ),
z=z 1 +ξ 3 m(z 2 −z 1 ).
Define a variablenmas 1 if (27.54) is satisfied for all eight combinations ofi, j, k
values and as 0 otherwise. The volumeVcan then be estimated using 3Mrandom
numbers from the formula
V
(x 2 −x 1 )(y 2 −y 1 )(z 2 −z 1 )
=
1
M
∑M
m=1
nm.