In one dimension, if

is integrable on the interval

, then the average value of

is

. From this, the nonadaptive (basic) Monte Carlo method estimates the integral by

, where

is the mean of the function evaluated at

randomly sampled points. The corresponding error estimate is

, where

is the variance of the function evaluations. Thus the error can be reduced by increasing the number of sample points or reducing the variance. The key idea of adaptive Monte Carlo is to reduce the variance by recursive subdivision. Parts of this Demonstration are modifications of examples from the Wolfram
Mathematica Documentation Center tutorial "Advanced Numerical Integration in
Mathematica"
(see link below). Students should try to explain why Monte Carlo integration has more difficulty for the function with the singularity at 0. (Hint: look at the formulas for the integral estimate and error estimate.)