Skip to main content

Module monte_carlo_integration

Module monte_carlo_integration 

Source
Expand description

Plain Monte Carlo integration over boxes.

See the book entry Monte Carlo and quasi-Monte Carlo integration.

Structs§

MonteCarloResult
The outcome of monte_carlo.

Functions§

monte_carlo
Estimates ∫ f over the box bounds (one (lower, upper) pair per dimension) from samples uniformly distributed points: the volume times the sample mean of f, with its standard error. The error falls like 1/√N whatever the dimension. seed makes the result reproducible.
monte_carlo_integration
Monte Carlo integration until a target accuracy: samples are drawn in batches of convergence_tuple.1 until the standard error of the estimate falls below convergence_tuple.0 (an absolute error target), or until max_samples have been used, in which case the current estimate is returned. Without max_samples, failing to converge within 10⁹ samples is an error (the integrand may have infinite variance).