Pi Approximation

less than 1 minute read

There are many ways to approximate Pi. The most basic one which has a nice geometrical interpretation is shown below. It is a Monte Carlo style of approximation, such that we randomly throw points in a unit square which contains quarter of a circle. Then, the value of Pi is simply the ratio between the points inside the quarter circle and all generated points multiplied by 4. We can observe one such simulation below:

Animation of the Pi approximation using quarter circle
Animation: Approximation of Pi

Although this has a nice geometrical interpretation, it is not an effective method to approximate Pi. The source code related this visualization can be found in this GitHub Gist. For more information, please follow me on Twitter.

If you liked what you just saw, it would be really helpful to subscribe to the mailing list below. You will not get spammed that's a promise! You will get updates for the newest blog posts and visualizations from time to time.

Updated:

Leave a comment