How to grow a brain

How to grow a brain

How to grow a brain

Mathematics are amazingly essential, and beautiful. They are everywhere in Nature, and bring to existence things of exquisite delicacy for our sense. I am not necessarily talking of very sophisticated mathematics, not at all. Seriously, you can simply consider Grade 6 maths for instance, and just play with triangles and square tiles. Ultimately, this could be done with paper or with colored lego parts.

Take our good old Pythagoras for instance, and its formula about square triangles: c² = a² + b²

This can be easily proven using legos, as I said:

pythagoras-3-4-5 triangle-3-4-5-leg

For those after the basics regarding Pythagoras Theorem:


What you can do from there, is to simply iterate, ad infinitum … until you get some sort of tree, the slice of a white cabbage, or something that looks like a brain. Just iterate: 1 … +1 … +1 … +1


Fiddling with parameters and palettes, you can get interesting variations:

It was really fun diving back into Trigonometry 101, although a bit painful. At my age, you realise how clumsy and rusty some neural networks have become. I wish I knew how to grow my brain again?

Trigonometry 101

From a code perspective, I started with a dead simple algorithm, based on pushing and popping the Processing 2D matrix. However, I felt unsatisfied with the outcome, as it was depressingly flat. With this fractal and iterative approach, and the resulting helicoidal patterns, I obviously needed some sense of depth! Problem was that big squares ere traced first, and then smaller iterated ones piled up on top: That did not work.

The solution was to take a step back, pre-generate all the squares and store them in an array, and then draw them backwards, from back to front. I had to revive a few of my Java skills and eventually got something workable (see code below).

The rest was simply about selecting some nice color palettes, and rendering it!

Palette Random1:


Palette ForestDew:

forest dew Color Palette -

Techniques: Processing, Pixelmator.

Making of:

Source code for Processing:


How to grow a brain

Leave a Reply