# Adaptive Monte Carlo Integration

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

This Demonstration compares adaptive and nonadaptive Monte Carlo integration for two different functions, and . The plot shows the places on the interval where sample points are added as the number of sample points is increased. The actual values of the integrals to six significant figures are 2.66667 and 5.65685. The adaptive technique generally gets better estimates with the same number of sample points by subdividing the subinterval with the highest error estimate. Normally this process would be repeated until some error criterion is satisfied, but in this Demonstration only four subdivisions are shown.

Contributed by: Sijia Liang and Bruce Atwood (January 2013)

(Beloit College)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

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.)

## Permanent Citation

"Adaptive Monte Carlo Integration"

http://demonstrations.wolfram.com/AdaptiveMonteCarloIntegration/

Wolfram Demonstrations Project

Published: January 25 2013