Back to Posts

Regularly Expressional Fractalations

Posted in Mathematics, Art

There’s something about fractals that humans find fascinating. They manage to contain a beautiful impression of infinity despite being not very difficult to create. These fractals have been produced by a very simple recipe:

quadrant_numbering2

  1. Split a big square of pixels into 4 quadrants and label them 1 to 4
  2. Repeat this process for each of the smaller squares and add the quadrant number to the label
  3. Keep cutting the squares into 4 until you’ve gone as small as you want
  4. Now we can use regular expressions to find and mark boxes with certain labels

I wrote a little bit of javascript that creates such fractals from regular expressions involving the digits 1, 2, 3 or 4. Have a play here and check out some examples below.

1

1

[13][24][13]

1

12|21|34|43

1

13|24

1

13|31|24|42

1

[34]+2

1

Jamie Quinn was born in Glasgow and raised on a steady diet of music, technology and delicious food. He is now a full time PhD student at the University of Glasgow investigating fluid dynamics, solar physics and damn hot plasmas.

Read Next

How I lost a Day to OpenMPI Being Mental