I saw an example in A New Kind of Science of a cellular automaton that
would generate the square of any natural number entered into it. A
cellular automaton is basically a set of cells that are all connected
to each other in the same way and each are at one of a particular number
of states. Each cell at each step is updated by whatever rules you
choose, based on the states of the cells connected to it. it.
Anyway, this cellular automaton could compute the squares of natural
numbers. Each square in it used only the 3 squares directly above it to
determine its color, using 8 colors. I thought that was interesting, so I
decided to try making one myself.
My first attempt used 9 colors, and for some reason I didn't save the
rules to that one, but I soon found how to reduce it to 8 colors. Here's a
picture of how it calculates the squares of the numbers from 1 to 5.
This one requires an input of n black squares followed by an orange
square and returns a row of n^2 black squares. It follows basically the
same idea as Wolfram's version, so far as I can tell by looking at the
picture. The idea is, for a given n, to add n together n times. I stayed
up all Sunday night making this. I couldn't stop myself.
|
These are my next two attempts. In the left one, I was able to alter the
design slightly to make it work for only 7 colors, and in the left one I
compacted it some more for only 6. These two take an input of n black
squares and return a row of n^2 red squares. You can see how each time
I was able to improve the design to allow for fewer colors. Some time and
frustration later, however, I was still unable to make this basic design
work for 5 colors. I worked and worked, and almost had it, but each time
something would screw up right at the very end, and any attempt to fix it
would invariably cause it to go completely haywire. However, Wednesday
afternoon, I suddenly thought of a different design that I thought could
work much more easily.
THIS was the result. It's pretty obvious from looking at this that it is
rather different from the previous 3. It's based on the fact that the nth
square is always the sum of the first n odd numbers. So for example 1^2=1,
2^2=1+3, 3^2=1+3+5, 4^2=1+3+5+7, etc. It's easy to prove if you draw a
picture. Anyway, the expanding blue region effectively counts off odd
numbers, while the region on the left grows larger until it gets too close
to the blue region. Each number is entered as a row of black, followed by
a blue and a yellow. Isn't it cool!?
|
Incedentally, in the course of these experiments, I discovered
another use for my synesthesia. All the colors in the pictures are the
colors I have for the numbers that I used to designate them when I was
programming. It was very helpfull because I could look at the picture and
immediately see the rule I had to change or add because the colors so
strongly suggest the numbers that represented them.
I'm done with A New Kind of Science. It's really an amazing book,
and it gets more amazing with each chapter. Every chapter has some amazing
new revelation about something, although it is one of the freakist and
most obnoxious books I've ever read.
All of these pictures were
made with
Mathematica. It's the easiest way I know of to program, and it's
more addictive than a nintendo.
|