Walkoscope

An idea that is doubtless not new, but fun and one that I like.

First off, let’s do a random walk.

What’s a random walk?

It’s where you take a imaginary critter on a grid of pixels, and you tell it to either go left, right, up, or down, depending on the roll of a dice.

This is a simple example using John Zelle’s graphics.py and the python computer language

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

from graphics import *
import time, random
def main():
win = GraphWin("Walker of 2", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
time.sleep(0.001)
cx = cx + random.randint(-1,1)
cy = cy + random.randint(-1,1)
win.getMouse() # pause for click in window
win.close()

main()



It produces something like this:

The critter starts out in the middle of the page and randomly doodles across it, eventually winding up leaving the page.

Now.. what if , instead of random numbers… you use the digits of the square root of 2? Say we get the digits from Nasa, here http://apod.nasa.gov/htmltest/gifcity/sqrt2.1mil

$\sqrt{2} \approx 1.41421356237309504880168872420969807856967187537694807317...$

They look random-ish, but they aren’t because you can predict them! But let’s try feeding them to our walker.

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# sqrt2 in 'sqrt2.txt'
# Robert Nemiroff (George Mason University and NASA Goddard Space Flight Center)
# and Jerry Bonnell (University Space Research Association and NASA Goddard Space Flight Center)
# linux$wget http://apod.nasa.gov/htmltest/gifcity/sqrt2.1mil # linux$ cat sqrt2.1mil | sed s/[^0-9]//g | tr -d \\n > sqrt2.txt

from graphics import *
import time, random

f=open('sqrt2.txt')

def nextnum():
global f
if digit>6: return 1
if digit<3: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + random.nextnum()
cy = cy + random.nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

Basically, every time the digit is 0, 1, or 2, the generator creates “-1” and gives it to the critter, to move left or up. If the digit is 7 8 or 9, the generator creates “1” and the critter moves either right or down. If it is 3 4 5 or 6 the critter doesn’t move at all. That’s the generator creating 0.

You get something like this:

Leave it to run a bit longer, you get this

Now… notice this isn’t random. If you run the program again, you get this same shape. There is no pseudorandom seed here. We are just using digits of square root of 2.

Now. What if we alter the way it works a bit?

What if the digits 0, 1, 2, or 3 generate “-1” and 6, 7, 8 or 9, generate “1”, and give it to the critter? If the digits of $\sqrt{2}$ are relatively evenly distributed amongst 0,1,2,3,4,5,6,7,8,9 then the result should be a bit more ‘movey’ because we are getting less ‘0’ so the critter should be moving more. Right?

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# sqrt2 in 'sqrt2.txt'
# Robert Nemiroff (George Mason University and NASA Goddard Space Flight Center)
# and Jerry Bonnell (University Space Research Association and NASA Goddard Space Flight Center)
# linux$wget http://apod.nasa.gov/htmltest/gifcity/sqrt2.1mil # linux$ cat sqrt2.1mil | sed s/[^0-9]//g | tr -d \\n > sqrt2.txt

from graphics import *
import time, random

f=open('sqrt2.txt')

def nextnum():
global f
if digit>6: return 1
if digit<3: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + random.nextnum()
cy = cy + random.nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

Well… maybe not. Here is what you get:

And a bit longer…

Ok honestly I think this is cool, but I don’t see the difference that much. I mean one looks a lot like the other… but not so much alike that I could tell the difference between them and a random walk. Weird right? Square root 2 is supposed to be predictable. Can you tell the pattern just looking at the digits? What about a random walk based on the digits?

But… if you saw those patterns repeatedly, you’d be able to pick them out as belonging to square root 2… they are individually recognizable, with their various bumps and valleys and whatnot.

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# sqrt3 in 'sqrt3.txt'
# Robert Nemiroff (George Mason University and NASA Goddard Space Flight Center)
# and Jerry Bonnell (University Space Research Association and NASA Goddard Space Flight Center)
# linux$wget http://apod.nasa.gov/htmltest/gifcity/sqrt3.1mil # linux$ cat sqrt3.1mil | sed s/[^0-9]//g | tr -d \\n > sqrt3.txt

from graphics import *
import time, random

f=open('sqrt3.txt')

def nextnum():
global f
if digit>5: return 1
if digit<4: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + nextnum()
cy = cy + nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

OK…

How about e? Euler’s number. 2.7…. and all that.

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# e in 'e.txt'
# Robert Nemiroff (George Mason University and NASA Goddard Space Flight Center)
# and Jerry Bonnell (University Space Research Association and NASA Goddard Space Flight Center)
# linux$wget http://apod.nasa.gov/htmltest/gifcity/e.5mil # linux$ cat e.5mil | sed s/[^0-9]//g | tr -d \\n > e.txt

from graphics import *
import time, random

f=open('e.txt')

def nextnum():
global f
if digit>5: return 1
if digit<4: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + nextnum()
cy = cy + nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

Well. It seems to be a bit off the map, yes? Let’s try to narrow it down a bit, less movement perhaps?

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# e in 'e.txt'
# Robert Nemiroff (George Mason University and NASA Goddard Space Flight Center)
# and Jerry Bonnell (University Space Research Association and NASA Goddard Space Flight Center)
# linux$wget http://apod.nasa.gov/htmltest/gifcity/e.5mil # linux$ cat e.5mil | sed s/[^0-9]//g | tr -d \\n > e.txt

from graphics import *
import time, random

f=open('e.txt')

def nextnum():
global f
if digit>6: return 1
if digit<3: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + nextnum()
cy = cy + nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

Nope, didn’t help

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# pi in 'pi.txt' from Dave Andersen's angio.net
# https://www.angio.net/pi/digits/pi1000000.txt
# linux$wget https://www.angio.net/pi/digits/pi1000000.txt # linux$ cat pi1000000.txt | sed s/[^0-9]//g | tr -d \\n > pi.txt

from graphics import *
import time, random

f=open('pi.txt')

def nextnum():
global f
if digit>6: return 1
if digit<3: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + nextnum()
cy = cy + nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

And what about the Golden Ratio? Phi? 1.618…? The beautiful ratio?

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

# golden ratio, or 'phi' in phi.txt
# from Gary B. Meisner's goldennumber.net
# linux$wget http://www.goldennumber.net/wp-content/uploads/2012/06/Phi-To-100000-Places.txt # linux$ cat Phi-To-100* | sed s/[^0-9]//g | tr -d \\n > phi.txt

from graphics import *
import time, random

f=open('phi.txt')

def nextnum():
global f
if digit>6: return 1
if digit<3: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + nextnum()
cy = cy + nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()



Now. Are these not distinguishable from each other? I find that absolutely fascinating.

If I were looking at a random chunk of digits from one of these numbers, sqrt 2, sqrt 3, e, phi, or pi, I doubt I could tell them apart.

But in ‘Walker’ format, I can identify these shapes, blobs, agglomerations, seas, fjords, whatnot and whoseits. Essentially, I am looking at thousands and thousands of digits at once, represented in a different form.

Now… use imagination and … think about what happens if every infinite-sequence number, like square root 2, square root 3, pi, e, etc, has a “shape”.

In the number-line picture of life, the ‘shape’ is like any other number.

The golden ratio (1.618..), sqrt 2 (1.4…), e (2.7…), pi (3.14…), everything, is just another point on the real number line.

In this perspective, there is no difference between 0, 1, sqrt2, 2, 3, pi, 3, phi, etc.They are just points on it.

But imagine instead if each one is a different input for a “Walker”. We have seen the irrational sqrt 2 and sqrt3 and phi, we have seen the transcendental of pi and e.

But what if we look at a random walk of… the digits of the square root of 1? Or the digits of the square root of four?

# wget http://mcsp.wartburg.edu/zelle/python/graphics.py
# Dr John M Zelle's graphics.py

from graphics import *
import time, random

def nextnum():
global f
digit = 0
if digit>6: return 1
if digit<3: return -1
return 0

def main():
win = GraphWin("Walker", 500, 500)
cx,cy=250,250
quit = False
while not quit:
c = Point ( cx, cy )
c.draw( win )
#time.sleep(0.001)
cx = cx + nextnum()
cy = cy + nextnum()
win.getMouse() # pause for click in window
win.close()

main()
f.close()

How does it work? Well, the square root of 1 is

$1.00000000000000...$

Not much complex going on… the Walker has no input except to walk in the same direction, or stay in the same place, depending on how you deal with the digits.

In fact I would argue it’s a bit difficult to tell one Rational from another, going just by the Walker trail, because they all look pretty much the same.

$\sqrt{4}=2.00000000000000...$

$17=17.000000...$

Even something that cannot be expressed as a finite decimal, well, if it is a repeating decimal…

$\dfrac{1}{3}=0.33333...$

You’d get the same pic. And what about something with repeating digits? Let’s say you had a number that just repeated over and over these digits…

1.239172832834419453627412364951802341802354701257348015278304

239172832834419453627412364951802341802354701257348015278304

239172832834419453627412364951802341802354701257348015278304

There are rational numbers that can create such repetitions in decimals. But realize, they are still Rational! They are not irrational nor transcendental. But what would the Walker look like?

Well, you’d get a repeating Walker, like this. It’s a bit hard to tell but there is a little curli-cue thing going on before it travels off the left side of the screen.

You see… these numbers with Rationality have a different walk, very different, than the Irrationals and Trascendentals.

Then what is going on with the Number Line? Why do these items look the same on it, but so different from the viewpoint of the Walker?

In fact, perhaps we can think of the walker as a sort of “Microscope” that peers down into the infinitudes of irrationals and displays them for us in magnified, alternative format?

Of course, the decimal expansions do the same… but I am speaking of Human Perception itself. We perceive a string of numbers one way… but with a sort of 2 dimensional walker trail, we gain some kind of “Feeling” or “pattern recognition” that sets in the human mind in a different fashion. If one were blind, one could ‘feel’ the Walker trails if they were printed in an embossed format of some kind, as on a paper with raised bumps or a 3 dimensional model. Perhaps there are even ways to sonically represent these walks.

So then what is going on with the Real Number Line?

Well.. let’s think about the 2 dimensional version of the real number line… the Descartes’ Grid.

Now imagine drawing a line from 0,0 to 1,1 coordinates.

If you were a doodlebug, you could go East for one unit, then North for one unit.

As you may know, the distance travelled by the green path, the Doodlebug, is 1 +1 or 2.

But the distance “as the crow flies”, on the black line, is this thing called Square Root of Two. How? Well, there is the method of the Pythagorean Theorem, where one can analyze any triangle for the pattern of

Hypoteneuse squared = leg squared + leg squared

Q3=Q1+Q2, squares of the distances of a triangle form an exact pattern

That is the funny thing, though. The Distance itself is not exact… but somehow if you look at the Squares of distance, they are exact. The Pythagorean Theorem is not about approximations, it says that the square of the hypoteneuse Exactly equals the sum of the sides squares.

And… sometimes, the distances are exact as well. For example the triangle with legs of 3 and 4, and the hypoteneuse of 5.

5 is not irrational, it is an ordinary integer!!!

It’s a special pattern, called a Pythagorean Triple, on a Pythagorean Triangle, where all of the legs and hypoteneuse are integers. But only some triangles are like that! Not all of them!

Most of these are not Pythagorean triples, so the distances are not Rational

As we have seen, the 1x1xsqrt(2) triangle is not. Square Root of 2 is not Rational and not an Integer. Even this, the most basic of basic triangles, the basic concept of distance on a Cartesian grid, boiled down to a 1×1 square, contains within it this miraculous creature:

Walker trail of Square Root of 2

And this is combined with two of these:

Walker trail of square root of 1

It is almost as though the Pythagorean formula lifts us to a different plane of existence, where the Walker Trails of the fantastic varieties are all transformed into the straight lines of the Rationals. For the square of a distance in a Cartesian grid of Rational coordinates is always Rational, no matter its strange formulation.

So then, perhaps…. maybe Distance itself is a Weird Concept. But virtually everything we use to describe the world with math involves the concept of Distance. Distance = Rate Times Time, Distance tells us how long something will take, Distance tells us the amount of Energy involved in something, Distance is calculated to deal with radiation treatments and magnetic devices and on and on.

And yet… distance is so much more complicated and fascinating than it’s picture on the number line. Through an alternative viewpoint, Distance is a garden of fascinating creatures and brilliant and beautiful patterns.

If we cannot quite understand Distance, then.. maybe there is something about our general existence, itself, that we don’t understand?

And then, what is left to be discovered in the nooks and crannies of this grid system, that we have had for about 4 centuries now?

For a much better discussion of these topics, I would highly recommend that you may enjoy this video by Norman Wildberger of the University of New South Wales:

Math Foundations 80 – Inconvenient Truths about the Square Root of 2