Photo by Chaitanya Tvs on Unsplash

Visualizing the Beauty of Pi

Various still and animated visualizations made from the digits of Pi

Aqeel Anwar
Towards Data Science
4 min readMar 15, 2021

--

Note 1: The graphics are rendered in high resolution to be viewed clearly. Please give some time for the graphics to load.

Note 2: The high resolution pdf version of these graphics can be downloaded from www.pi.aqeel-anwar.com

Note 3: More visualizations will be added to this article over time.

Pi is the ratio of a circle’s circumference to its diameter and is one of the most important numbers in our universe. It’s a non-terminating, non-repeating decimal which means that no group of digits repeat endlessly. Using Google cloud, Emma Haraku set the record of most digits of pi calculated to 31.4 trillion. Just to give you a perspective, it will take a human nearly 100 years to pronounce these digits of pi.

In this article, we will try to visualize pi through different animations and plots.

1. Pi on a grid

Pi on a grid plots circles of equal sizes from left to right and top to bottom. The colors of the circles identify digits from 0–9 and the face color is empty if the digit is odd. The grid graphs below plot the 100, 400, 2500, and 10,000 digits of Pi.

Image by Author
Image by Author

2. Random walk of Pi digits

Each digit is assigned an angle equally spaced between [0 – 360 degrees). For each digit, a walk is advanced in the respective direction with an equal step size.

The graphs below plot the walk for 100, 500, 1000, and 10,000 digits of Pi.

Image by Author
Image by Author
Image by Author

3. Circular web-walk of Pi:

Inspired by Martin Krzywinski, the circular web-walk plots the walk for the digits of Pi in a circular pattern. The graphs below plot the walk for 100, 1000, 5,000, and 10,000 digits of Pi.

Image by Author
Video by Author

4. Probability Histogram of Pi:

This visualization shows the distribution of the numbers so far seen in the first n digits of pi. It can be seen that the digit 0 is the last one to occur, while the digit 3 is the most dominated one in the first 100 digits of Pi.

Image by Author
Image by Author

Summary:

A picture is worth a thousand words or in this case, A picture is worth tens of thousands of digits. From the various visualizations seen above, it can be seen that there is no observable pattern hidden in the digits of pi. As the number of digits increases, not only does the frequency of occurrence of all the digits from 0–9 becomes equal (probability histogram) but also the frequency of occurrence of all the possible 2 digit patterns (11, 12, …, 19, 21, 22, …) becomes equal too (circular web-walk).

If this article was helpful to you, feel free to clap, share and respond to it. If you want to learn more about Machine Learning and Data Science, follow me @Aqeel Anwar or connect with me on LinkedIn.

--

--