2 ms·
A monte carlo simulation is fundamentally a way to compute an operation over a probability density - most commonly computing integral f(x) p(x) dx. For example
by yummyfajitas 10y ago
A monte carlo simulation is fundamentally a way to compute an operation over a probability density - most commonly computing integral f(x) p(x) dx.
For example, suppose you have q(x) = C p(x), with p(x) the true probability density (classical setup for MCMC).
If x \in [0,1], then the easiest way to compute p(x) is:
x = arange(0,1, 1/1024.0)
px = q(x)
px /= sum(px)
Then if you wanted to compute integral f(x) p(x) dx, you'd just do:
sum(f(x)*px)
In short, my claim is that computer simulations are typically ways of computing integrals. Monte carlo is just a very generic brute force method of doing that. But if you get clever and truly understand your specific problem, you can nearly always come up with a non-generic and non-random way of solving things that's probably a lot faster.