pub fn monte_carlo_integration<F>(
f: F,
bounds: &[(f64, f64)],
convergence_tuple: (f64, usize),
max_samples: Option<usize>,
) -> Result<f64, ErrorsJSL>Expand description
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).
The standard error falls like σ/√N, so halving it costs four times the samples.