Happy Pi Day! On March 14 we celebrated π because 3-14 gives the first three figures of this famous number. How important is to dedicate a day? To begin with, define the simplest and perfect way: the circle. So it is everywhere. Pi is the relationship between the circumference and diameter of a circle: π = c/d.
No matter how big or small a circle, that quotient is always the same. In decimal notation it is 3,141592653. You can take it as far as you want, because it is an irrational number and never ends. What the calculators do if you press the π button is to choose a certain number of decimals depending on the required precision, and round that number. It is not Pi, but it could be said that it is a “piece of pi”.
The irrational is what does the irrational
Let’s leave something clear: being infinitely long does not convert an irrational number. Suppose we have a rectangle that measures 4 by 11 meters. The sides ratio, 4/11, is equal to 0.36363636. This number is infinite, but follows a pattern. There is no repetition with irrational numbers.
On the other hand, rational numbers can be written as a quotient of two whole numbers. And quotients are the same as fractions:
Rhett Allain
It also happens that any finite decimal number, however long, can be expressed as a ratio of two integers. Irrational numbers cannot be expressed fractionally. For example, 22/7 is a fairly close approach, but it’s not Pi. We could celebrate the Pi Day on July 22, since most of the world uses the day-mean format for dates, and that would be 22-7.
I will use an algorithm of brute force that I made in Python to generate all possible entire fractions and see if one of them is equal to π.
No Pi in Python
First we define what a brute force method is: it is a way to solve a problem that does not require ingenuity, just a lot of work. My program begins with fraction 1/1 and is increasing methodically by adding 1 to the numerator or denominator. This is the recipe:
– Take the fraction (U/V) and share it with Pi
– If U/V is less than Pi, add one to the numerator (U+1)
– If U/V is greater than Pi, one adds to the denominator (V+1)
– If U/V is the same as Pi, you won. You just demonstrate that Pi is rational.
Then the series begins like this: 1/1, 2/1, 3/1, 4/1, 4/2, 5/2, 6/2, 7/2, 7/3, 8/3 … that is, you could do this on paper, but you would go crazy. I executed my program to iterate 1,000 times. If you want to see the code, you can find it in Google Colab. Then I checked the decimal value for the 1,000 fractions. As the horizontal axis ranges from 1 to 1,000, I am using a logarithmic scale to compress it.
#visualize #number #understand