In addition to being a blogger here at MNN, I'm also a gone-back-to-school student studying for degrees in computer and environmental sciences. I'm really interested in the intersection of computers and ecology and I get to spend the next four years learning everything I can about it.

Chaos theory is a particularly fascinating topic that has countless applications in science, technology and ecology. Chaos is not an easy concept to wrap your head around, with advanced math degrees required to understand some of the deeper concepts, but one of the more accessible ideas that attracted me was the idea of complex behaviors arising from simple rules.

Simple rules like this one, which gives the Fibonacci sequence:

Start with a list (0, 1). Add the two right-most numbers (0 and 1) and place the sum (0 + 1 = 1) at the end of the list (0, 1, 1). Keep doing that as many times as you need.

(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...)
(0, 1, 1, 2(1+1), 3(2+1), 5(3+2), 8(5+3), 13(8+5), 21(13+8), 34(21+13)).

It turns out that physical manifestations of the Fibonacci sequence pop up all over the place in nature. We see it in hurricanes, broccoli, river systems, circulatory systems and entire galaxies. Vi Hart of the Khan Academy has a great series of videos on Fibonacci. Here's one below:

Another beautiful fractal is the Mandelbrot Set. It's slightly more complicated than the Fibonacci sequence, but not by much — take a number, square it and add it to itself. Keep doing that for as long as you need. With that simple recipe you can create images and forms of infinite complexity. I made an infographic for a pal in one of my university classes last year that goes into a lot more depth on the Mandelbrot Number and how to draw it with code.

One of the first books I turned to for answers when I caught the fractal bug was "Chaos: Making a New Science" by James Gleick. It does a good job of chiseling through the complexity of chaos theory by telling the story of the history of chaos science.

In his book, Gleick describes something he calls the chaos game — write two arbitrary rules for how to move from one point to another in a two-dimensional plane. Start by drawing a dot at any random point, flip a coin, and apply one of the two rules depending on how the coin lands to decide where to draw the next dot. Do that a million times or so and you can find, within the randomness of the million dots drawn, structure and order. Beautiful structure and order that looks similar no matter how deeply you look.

Since I'm a budding programmer, I decided to write some code that would allow me to replicate Gleick's chaos game. I can design any kind of rule with my program and pair them together. Here are some of the rules that I used:

• Pick two random values between 0 and 50 and set those to the X and Y coordinates of the next dot.

• Measure how far the current dot is from the origin (0, 0), and divide that by a random number between 1 and 13. Move the next dot that far towards the origin.

• Draw the next dot halfway between the current dot and the center of the view screen.

• Switch the X and Y coordinates of the current dot and draw the next dot there.

By mixing and matching these rules, and the others I wrote, I got different kinds of images. Drawing more or fewer dots revealed structure everywhere.

Here are a few of the images I made by applying these rules millions of times in each go. From randomness emerges form.

Chaos game image creation

Chaos game image creation

Chaos game image creation

Chaos game image creation

Chaos game image creation

Chaos game image creation

Chaos game image creation

I'm just in my second year out of five, so I still really have no idea what I'm doing yet, but I'm having fun bumbling around trying to learn more.


Shea Gunther is a podcaster, writer, and entrepreneur living in Portland, Maine. He hosts the popular podcast "Marijuana Today Daily" and was a founder of Renewable Choice Energy, the country's leading provider of wind credits and Green Options. He plays a lot of ultimate frisbee and loves bad jokes.

Finding structure within randomness
Following in the footsteps of Fibonacci and the Mandelbrot Set, a computer program creates beautiful structures of chaos.