Friday, December 12, 2008


I've been sketching binary in my notes ever since I learned what binary was - I usually draw a box for every 1 and leave a blank for 0. There is a load of things you can do with this (try making the 1s into cubes and translating words into binary and then stacking them into massive 3D structures). It's pretty time consuming (and difficult at times), which is what makes it fun, but also serves as a limitation when I want to look a the patterns that are produced. 

So I wrote a quick javascript bit to generate binary with black boxes for 1 and light grey for 0 - it has the place value along the top (the leftmost column is 1, then 2, 4, 8, et cetera moving to the right) and each row is a number in a function f(x). The image to the right is f(x)=x. It is much prettier when drawn by hand, but the pattern is lovely either way. 

Notice that each column has a pattern - the rightmost one is every other, the next is two 1s and then two 0s - it's pretty obvious how it will continue in this case. 

It get more complicated as the function gets more complicated, or course. 
Here is f(x)=x^2

There is still a pattern to each column, but much less obvious.
But that's not all! There's another way that I like to visualize it - using 
a diagonal line instead of a solid going from right to left or left to right depending on the number. This tends to just look like noise when the functions get more complex, but it can produce some lovely results.

The clip I've got here if f(x)=x, starting at about f(101), as there is more to see with the bigger numbers.

No comments:

Post a Comment