The year was 1946. Physicists at Los Alamos Scientific Lab were investigating radiation shielding and distance neutrons would travel in various materials. Despite having the data, the problem could not be solved with analytical calculations.
At the very same time, Stanislaw Ulam was convalescing from an illness and playing solitaires and thinking. His thoughts meandered around what are the chances that a Canfield solitaire laid out with 52 cards will come out successfully?
Stanislaw says “After spending a lot of time trying to estimate them by pure combinatorial calculations, I wondered whether a more practical method than “abstract thinking” might not be to lay it out say one hundred times and simply observe and count the number of successful plays. This was already possible to envisage with the beginning of the new era of fast computers, and I immediately thought of problems of neutron diffusion and other questions of mathematical physics, and more generally how to change processes described by certain differential equations into an equivalent form interpretable as a succession of random operations. Later, I described the idea to John von Neumann, and we began to plan actual calculations”
Thus the Monte Carlo Method was born.
Monte Carlo methods are a class of computational algorithms that rely on repeated random sampling to compute their results. These methods are most suited to calculation by a computer and tend to be used when it is infeasible to compute an exact result with a deterministic algorithm. Source wikipedia
If you read through the above Wikipedia article, it explains a method to estimate the value of Pi approximately using Monte Carlo Method. So here’s the Fortran program just doing that.
It uses PGPLOT as the graphics engine and you can see graphically see how the program estimates the value of Pi.
Really cool!! But not as cool as neutron collisions!