pub fn monte_carlo<F: Fn(&[f64]) -> f64>(
f: F,
bounds: &[(f64, f64)],
samples: usize,
seed: u64,
) -> Result<MonteCarloResult, ErrorsJSL>Expand description
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.