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.

This slideshow requires JavaScript.

Really cool!! But not as cool as neutron collisions!

Download the program and Download the source

### Like this:

Like Loading...

*Related*

Tagged: animation, fortran, MonteCarlo, pgplot

Monte Carlo Java Calculating the value of pi « SukhbinderSingh.comOctober 25, 2012 at 2:07 pm[...] Have done it in Fortran using pgplot as the GUI engine. You can see it action here. [...]

A Simple Fortran code to Simulate Stochastic Stock Price Movement | SukhbinderSingh.comJune 12, 2014 at 3:47 am[…] few months ago I posted this pgplot powered fortran animation program on calculating the approximate value of PI by Monte Carlo method using random […]