Illustrating Pi

What is "Pi"?

The number π is a mathematical constant, the ratio of a circle's circumference to its diameter, commonly approximated as 3.14159. It has been represented by the Greek letter "π" since the mid-18th century, though it is also sometimes spelled out as "pi" (/paɪ/).

Being an irrational number, π cannot be expressed exactly as a common fraction, although fractions such as 22/7 and other rational numbers are commonly used to approximate π. Consequently its decimal representation never ends and never settles into a permanent repeating pattern. The digits appear to be randomly distributed; however, to date, no proof of this has been discovered.

More on Pi


The Illustration Concept

So what's the concept here? I thought, what if I could match each of pi's digits to a direction and then draw some of them to see the illustration of some of pi's digits? And so I did. Here is the matching table and the direction concept explained graphically.

Digit Angle Direction Compass
1 East Compass
2 45° Northeast
3 90° North
4 135° Northwest
5 180° West
6 225° Southwest
7 270° South
8 315° Southeast
9 360° East


The Code Implementation

Since I kinda like Python, I used Python's turtle library - a drawing library - to read pi's first 10,000 digits from a text file, put them in a list and then after the matching method let the turtle make some drawing!


What if I put some color matching beside direction matching? Hmmm. Things are getting more interesting and the graphic illustration result should now provide us with more information about the "randomness" of digits in pi. The colors I've chosen to represent each digit are: 1, 2, 3, 4, 5, 6, 7, 8, 9


The Result

Voila! Here’s how the first 10,000 pi’s digits are illustrated.

10k Digits 10k Digits with color