Pages

12 April 2024

An image of the number PI

This post is an application of GeoGebra 5. Find the manual here, and our complete ggb file here.



Part 1, construction


In this first part we construct a square grid centered at the origin, and a polygonal line starting in the origin and spiraling away from it, counterclockwise. Below is the result with the square having a side equal to 20. The grid contains 400 squares, and the line connects all 400 lower left corners.





The successive GeoGebra commands, explained further on, are the following 
  • d = 10
  • hori=Sequence(Segment((-d, k), (d, k)), k, -d, d)
  • verti=Sequence(Segment((k, -d), (k, d)), k, -d, d)
  • plus=Sequence(Sequence(1, m, 1, k), k, 1, 2d)
  • zero=Sequence(Sequence(0, m, 1, k), k, 1, 2d)
  • minus=Sequence(Sequence(-1, m, 1, k), k, 1, 2d)
  • odds=Sequence(k, k, 1, 2d - 1, 2)
  • xstepsb=Zip({minus(A), zero(A), plus(A + 1), zero(A + 1)}, A, odds)
  • xsteps=Flatten(xstepsb)
  • xstepscut=Sequence(xsteps(k), k, 1, 4d² - 1)
  • xs=Sequence(Sum(xstepscut(m), m, 1, k), k, 1, 4d² - 1)
  • ystepsb=Zip({zero(A), minus(A), zero(A + 1), plus(A + 1)}, A, odds)
  • ysteps=Flatten(ystepsb)
  • ystepscut=Sequence(ysteps(k), k, 1, 4d² - 1)
  • ys=Sequence(Sum(ystepscut(m), m, 1, k), k, 1, 4d² - 1)
  • xsys=Sequence((xs(k), ys(k)), k, 1, 4d² - 1)
  • points=Append((0, 0), xsys)
  • path=Polyline(points)


Part 1, explanation

 

  • d determines the size of the grid, which is contained in a square with lower left corner (-d,-d) and upper right corner (d,d). The number of squares in the grid is 4d^2, the first one with P_{1}=(0,0) as its lower left corner, the last one with P_{4d^2}=(d-1,-d). hori and verti are the horizontal and vertical segments in the grid. d can be any integer from 1 to 50.
  • odds is the sequence {1,3,5,...,2d-1}, used in the two ZIP operations, in which the step is 2.
  • The point describing the spiral takes, starting from the origin, 4d^2-1 steps, namely: 1 left, 1 down, 2 right, 2 up, 3 left, 3 down, 4 right etcetera. The corresponding effects on the abscissa are {-1,0,1,1,0,0,-1,-1,-1, 0,0,0, 1,1,1,1,...}. To construct this sequence we use three more basic sequences: plus is {{1},{1,1},{1,1,1},...}, zero has 0 instead of 1, minus has -1. All three end with a term containing 2d numbers. (In fact, there can only be 2d-1 steps in any direction.) Then xstepsb is {{{-1}, {0}, {1, 1}, {0, 0}}, {{-1, -1, -1}, {0, 0, 0}, {1, 1, 1, 1}, {0, 0, 0, 0}}, ...} and xsteps (giving the steps in the abscissa) is {-1, 0, 1, 1, 0, 0, -1, -1, -1, 0, 0, 0, 1, 1, 1, 1, ...}, as desired. This list contains redundant steps that extend the curve further than required, hence its restriction xstepscut to 4d² - 1 terms. Its partial sums are in xs, and these are the successive abscissas of the points on the path, origin not included. In the same way, the ordinates ys are obtained. Combining abscissas and ordinates we obtain xsys, being the points on the path without the origin, the latter being added in points. Finally, path is the polygonal spiral.


Part 2, construction 

The GeoGebra commands go on as follows.

  • digits is the sequence of the first 10000 binary digits of PI=11.001001... , including the two digits before the decimal point
  • pointsdigits=Sequence(points(k) digits(k), k, 1, 4d²)
  • pointsdigits1b=pointsdigits \ {(0, 0)}
  • pointsdigits1=Append((0, 0), pointsdigits1b)
  • squares1=Sequence(Polygon(pointsdigits1(k), pointsdigits1(k) + (1, 0), 4), k, 1, Length(pointsdigits1))
  • path'=Translate(path, (0.5, 0.5))
  • closure=Segment((d - 0.5, -d + 0.5), (d, -d + 0.5))
  • comma = (-0.5, 0)

Part 2, explanation

 

  • The sequence digits is obtained from here, by copying that many digits, adding commas, and pasting the whole between {}. This allows d to be as large as 50, because then 4d^2=10000.
  • In pointsdigits the k-th term is the product of the k-th point (x,y) on the path and the k-th digit of PI. If this digit is 0, the product is (0,0); else the product is (x,y). In pointsdigits1b all terms (0,0) have been removed, leaving the points (x,y) where the digit was 1, but also removing the origin which is the only (0,0) with digit 1. In pointsdigits1 the origin is added as the first term.
  • squares1 constructs the unit squares that have lower left cornes at the points where the digit is 1.
  • path' is a translation of path passing through the centers, not the lower left corners, of the squares, and closure is an extra segment extending it to the border. Finally, comma is a point on the path, separating the first two squares from the subsequent ones.




Comment

This representation of PI could easily be deciphered by intelligent beings in remote galaxies. It uses the most fundamental way of measuring, obtained by repeated doubling and halving of the unit length. (Our usual digits, on the other hand, are invented by creatures with ten fingers.) There are only two symbols required, one of which should be recognisable as being the smaller of the two; an empty square and a filled square do fine. Any two adjacent squares are unambiguously connected by a line, allowing anybody to pass from one square (or digit) to the next. The line has a beginning, but no end, as the procedure could be endlessy expanded beyond the view that is presented. A "decimal point" separates the first two squares from the subsequent ones. These two are necessarily "before the decimal point", where only a finite number of non-zeros can occur. Should our interstellar correspondent fail to see that filled=1 and empty=0, he could observe that 00 before the decimal point makes no sense, but 11 does. He might also appreciate our display of right angles – even the decimal "point" is a square – showing our use of this most fundamental of angles. Note that we avoid the human way of writing characters in lines of a fixed length, be it left-to-right, right-to-left of top-to-bottom; our spiral extends indefinitely.

 *