Pi day is back! I shouldn't actually considered it as such, since we Spanish-speaking people write this day as 14/3, instead of 3/14... however, since the 3th day of the 14th month isn't likely to arrive anytime soon, I may as well jump on the wagon. My humble contribution is an applet (see below) for estimating Pi by picking random points in a square.

But additionally, today is the birthday of Albert Einstein, who was born in Ulm, Germany, 128 years ago. He was a giant like few others, and we are still waiting for someone big enough to stand on his shoulders and see further. Before the pi applet, here are some quotes from Einstein; Bora has some more.

Anyone who has never made a mistake has never tried anything new.

There are two ways to live: you can live as if nothing is a miracle; you can live as if everything is a miracle.

Space and time are modes by which we think, not conditions under which we live.

Underlying the seeming differences between science and magic are more similarities than you might imagine. Both disciplines rely on a process sparked by mystery and nurtured by curiosity.

After a certain level of technological skill is achieved, science and art tend to coalesce in aesthetic plasticity and form. The greater scientists are artists as well.

Do not worry about your problems with mathematics, I assure you mine are far greater

And now, let's estimate pi. What's the idea? It's simple: we have a circle (of a certain radius R) inscribed inside of a square. Since the radius of the circle is R, the side of the square is 2R. The area inside of the circle is πR

^{2}, and the square's area, (2R)

^{2}=4R

^{2}. Thus, if we randomly pick a point inside of the square, the probability that it will fall inside the circle (and hence, the frequency with which this will happen) is (πR

^{2})/(4R

^{2}) = π/4. If we pick many points, and multiply by 4 the frequency with which we fall inside the circle, we will be increasingly close to the value of pi.

The applet is fairly intuitive; the points shown are the last 20 that have been picked (the fade away after 20 iterations), though the pi computation is done with the total accumulated points. With a few points, the "3" of pi shows up. Before 1000, the first decimal will converge to 1. Alas, maaaaany iterations are required to obtain (with a good probability) a good number of decimals; the 4th decimal will probably be beyond your patience.

Another method for estimating pi through probabilities (which is nicer, since there is no obvious circular thing in the setup) is through Buffon's needles.

Here is the applet; you can see the source code here: