UNPKG

@holgerengels/compute-engine

Version:

Symbolic computing and numeric evaluations for JavaScript and Node.js

20 lines (19 loc) 785 B
/* 0.26.0-alpha2 */ /** * Return a numerical approximation of the integral * of the function `f` from `a` to `b` using Monte Carlo integration. * * Thoughts for future improvements: * - use a MISER algorithm to improve the accuracy * - use a stratified sampling to improve the accuracy * - use a quasi-Monte Carlo method to improve the accuracy * - use a Markov Chain Monte Carlo method to improve the accuracy * - use a Metropolis-Hastings algorithm to improve the accuracy * - use a Hamiltonian Monte Carlo algorithm to improve the accuracy * - use a Gibbs sampling algorithm to improve the accuracy * * * See: * - https://64.github.io/monte-carlo/ * */ export declare function monteCarloEstimate(f: (x: number) => number, a: number, b: number, n?: number): number;