Pages

Sunday, August 4, 2013

Patterns of PI

I am fascinated with Pi. I wanted to make a fractal type graph of pi, so I wrote a script that generated x,y coordinates based on each digit:

start with the x,y coords as 0,0

now, take every digit of Pi, and convert it into an operator. even
numbers operate the X axis, odd numbers Y as follows

0 : x-2
1 : y-2
2 : x-1
3 : y-1

( 4 and 5 are midpoints and do nothing )

6 : x+1
7 : y+1
8 : x+2
9 : y+2

for example:

the first digit is 3 so, subtract 1 from y and now the x,y coords are 0,-1
the next digit is 1 so, subtract 2 from y and now the x,y coords are 0,-3
and so on through each digit of pi

I then graphed the output via xgraph... and here you go, I got up to 400,000 digits of pi

http://artofconfusion.org/pi/

if you want to see raw output of xy coordinates, look here

http://artofconfusion.org/pi/pi.php?size=1000


I am most familiar with php, so I made the initial script in php and it could only handle parsing up to 400,000 digits. Once I figure out how to do this with a shell script I hope to graph a million or more points.


No comments:

Post a Comment