computing integrals monte carlo integration for complex-shaped domains repeated use of one-dimensional integration rules to handle double and triple integrals constitute working strategy only if the integration domain is rectangle or box for any other shape of domaincompletely different methods must be used common approach for twoand three-dimensional domains is to divide the domain into many small triangles or tetrahedra and use numerical integration methods for each triangle or tetrahedron the overall algorithm and implementation is too complicated to be addressed in this book insteadwe shall employ an alternativevery simple and general methodcalled monte carlo integration it can be implemented in half page of codebut requires orders of magnitude more function evaluations in double integrals compared to the midpoint rule howevermonte carlo integration is much more computationally efficient than the midpoint rule when computing higher-dimensional integrals in more than three variables over hypercube domains our ideas for double and triple integrals can easily be generalized to handle an integral in variables midpoint formula then involves sums with cells in each coordinate directionthe formula requires nm function evaluations that isthe computational work explodes as an exponential function of the number of space dimensions monte carlo integrationon the other handdoes not suffer from this explosion of computational work and is the preferred method for computing higher-dimensional integrals soit makes sense in on numerical integration to address monte carlo methodsboth for handling complex domains and for handling integrals with many variables the monte carlo integration algorithm the idea of monte carlo integration of rb is to use the mean-value theorem from calculuswhich states that the /dx rb integral /dx equals the length of the integration domainhere batimes the average value of fnin oeabthe average value can be computed by sampling at set of random points inside the domain and take the mean of the function values in higher dimensionsan integral is estimated as the area/volume of the domain times the average valueand again one can evaluate the integrand at set of random points in the domain and compute the mean value of those evaluations let us introduce some quantities to help us make the specification of the integration algorithm more precise suppose we have some two-dimensional integral xy/dxdxwhere is two-dimensional domain defined via help function xy/ xyj xy that ispoints xyfor which xy lie inside "and points for which xyare outside the boundary of the domain @is given by the implicit curve xyd such formulations of geometries have been very common during the last couple of decadesand one refers to as level-set function and the