We periodically have art hackathons as a change to the usual talk or tutorial format. This month we held our first hackathon in Cornwall.
The theme for this hackathon was "Ghost In the Machine".
Hackathon?
In a hackathon we are free to create anything we want. The theme is there to inspire us, and can be interpreted in any way we wish.
Constraints, chosen carefully, provide a sense of common working but without feeling like your creativity is being clipped. For us the key constrain is to use openprocessing.org which is an online environment for using p5js.
In our group there was a range of experiences and also a range of ages - luckily openprocessing is both beginner friendly as well as a tool for more advanced creative coders.
In larger groups, people tend to self-organise into individuals and those working together. We also identify those who are able to help others, and those who want technical help.
For complete beginners I I usually refer to the creative coding for kids course, which although designed for children, has been successful with adults too:
Someone asked about the theme, so I explained that all of our themes for this and previous hackathons are chosen to resonate with a theme without being too prescriptive. There is often a reference behind the theme but it is not intended that everyone will know this. In short, a playful theme.
For me the phrase Ghost In The Machine refers to the philosophy of mind-body dualism, but my intention was to invoke the classic Japanese animation Ghost In The Shell, a beautifully crafted exploration of consciousness, synthetic bodies and machines, artificial intelligence, their co-existence and conflict.
Watching Ghost In The Machine in the 90s was a key moment for me - it set me on a lifelong journey into artificial intelligence, machine learning and algorithmic art.
Example Works
In the fixed timeframe of a hackathon most people find they don't finish wha they had planned. This is ok. Showing a work in progress, and talking about your inspiration and journey, what worked and what didn't, is often more interesting than a finished work in isolation.
The following are some examples from the group.
Jonathan worked, not with openprocessing, but blender to create the following beautiful mandala-like designs.
The following playful image of ghosts has an underlying mathematical structure as the number increases along the fibonacci sequence with each ring layer.
The following cute ghost was created by a young member who only learned to code very recently - lovely!
The following animated work was started as an interaction between two machines, with polygons of varying facets, to see if the combined motion had any interesting emergent or optical effects. Click the image to see it in motion.
The next animation was intended to show a rigid grid of dots - the machine - with other dots moving away from this rigid structure in an organic natural movement.
The next work was created in collaboration between two friends, one with more experience as an artist and the other with more experience as a developer.
It starts with the concept of boids, individual objects which move according to simple rules, but as an interacting collection, we see emergent behaviour such as flocking.
They wanted the red objects to turn on and off, and when on they were intended to repel the boids. Click the image to see the full animation and code.
Thoughts
I think initially the idea of hackathon without somone leading a talk or tutorial might have felt a little uncertain but once underway, with soothing visuals and clasical music, the room was soon a hive of activity!
Typically the show-n-tell, where we see each others work and hear the artists ideas and journey, is really interesting and inspiring - and this session was no different!
This month's meetup in Cornwall aimed to demystify how the famous Mandelbrot and Julia fractals are created.
We were also lucky to have Brod Ross, an artist from Falmouth, who shared his work and process creating stunning 3d scenes based on fractal constructions.
We started by taking a look at examples of patterns that looked organic and natural but were in fact created by a mathematical process.
Here is an example that has very fine filament-like details, combining a feeling of detailed thread work or the growth of an exotic plant.
The following is another example that looks like an underwater scene of seahorse-like creatures.
These patterns are entirely generated by a mathematical process. This surprises many as they're very organic and natural in form.
The previous two patterns are details from the famous Mandelbrot fractal. The following are examples of a related mathematical pattern called a Julia fractal.
These are more self-contained and a higher degree of symmetry.
These patterns are fractals - they are self-similar at different scales.
These fractals are named after the key characters who either discovered them, or did much of the ground-breaking work in the mathematical processes that create them - Benoit Mandelbrot and Gaston Julia.
Simple Maths
We then took our first gentle steps into mathematics to prepare ourselves for the ideas that lie behind these fractals.
The following expression x2 + c is rather simple. All it says is "square a number and add another number to it". Square means "multiply by itself".
For example, if x is 2 and c is 3, then x2+ c is 4 + 3 = 7.
Easy enough.
Yet surprisingly, this is the formula at the heart of the Mandelbrot and Julia fractals.
The stark contrast between the simplicity of this formula and the extremely detailed organic fractals we've seen is a perfect example of how mathematics has a beauty, hidden not too far under its surface!
Let's take another step.
The way this simple formula is used, is to take the answers it gives us and feed them back in again. The following picture explains this idea better.
So if x started at 2, and c is 3, we've seen the result is 7. Let's put that back in. So 72 + 3 = 52.
We can think of x2 + c as a machine that we feed, and that spits out an answer.
Let's look at a simpler example using a simpler machine:
This machine is simply x2. If we start feeding it 2, it spits out 4. If we feed that 4 back in again, it spits out 16. The sequence of numbers being spat out grows larger and larger through 256, 65536, and 4294967296 and upwards.
What happens if we start with not 2 but 0.5. The numbers seem to get smaller and smaller.
The starting number seems to decide whether the numbers get bigger or smaller.
Let's make a map of how numbers behave - a map showing whether numbers get bigger and bigger, or smaller and smaller.
The following shows the number 2 coloured green, because iterated through the x2 machine it gets bigger and bigger.
The next picture shows the number 0.5 coloured red, because iterated through the machine the numbers get smaller and smaller.
If we continue to test lots of numbers on the number line, including negative numbers we get a map that looks like this:
The negative numbers smaller than -1 are green because they do get bigger and bigger. Negative numbers squared become positive. The red region is around 0 and that makes sense because fractions less than 1 get smaller and smaller.
The map also shows 1 and -1 coloured blue because those numbers, when iterated through x2, don't get bigger or smaller, they stay at 1. The blue dots mark the boundary between the red and green territories.
So far, the maths has been easy. Let's take one more step.
Let's keep the idea of feeding a machine like we have before. Let's keep the idea of drawing a map to show how starting numbers behave.
But let's change the numbers to another kind of number called a complex number, even though they aren't complex at all!
Complex Numbers
Complex numbers aren't complex. They are just a composite number made of two normal numbers.
One part is called the real part, and the other is called the imaginary part. We mustn't let this surreal naming scare us away!
Things made of 2 parts or 2 numbers aren't unfamiliar. We're used to latitude and longitude on geographical maps, chess board positions or cells in a spreadsheet.
Because complex numbers have 2 parts, we can visualise them on a 2d surface like a grid or a map. It is normal for the real part to be along the horizontal direction, and the imaginary part along the vertical direction.
If we want to push these numbers through our machine, we need to know how to add and multiply them.
Adding complex numbers is easy - we just combine real parts with real parts, and imaginary parts with imaginary parts:
Multiplying is also simple in principle. We combine all the elements just like we might multiply out brackets at school algebra:
We can sweep together real parts and imaginary parts but we're left with an element with i2. In the above example it is 3i * 5i = 15i2.
What is i2? Let's look at the following picture showing what happens when 1 is multiplied by i. The result is a rotation of 90 degrees anticlockwise.
Another multiplication by i means another similar rotation which leads to -1.
So i2 = -1.
We can now finish our multiplication:
So now we know how to add and multiply complex numbers, we're ready to feed these numbers to a machine again.
We'll start x at 0 + 0i which is the complex number for 0. We can choose a complex number for c, we just need to stick with it consistently through all the calculations.
Because complex numbers are 2 dimensional, the map we draw to show how they behave as we iterate them through the x2 + c function will be 2 dimensional too.
Surprising Behaviour of Complex Numbers
Let's see what happens is we start with x = 0 + 0i and c = 2 + 2i.
We can see the complex numbers get bigger rand bigger. The second value is 2 + 2i, the third is 2 + 10i, and the fourth is -94 + 42i. On the graph we can see the numbers are spiralling outwards.
The following picture shows this spiralling out, and also the direct distance to the point - the magnitude of the complex number. We can see the magnitude gets bigger quickly.
Let's try c = 0.4 + 0.4i.
This time we can see the numbers spiralling around before finally escaping. The magnitude chart shows this eventual explosion. This is interesting behaviour given how simple the function x2 + c is.
Let's try c = -0.3 + 0.4i.
The numbers seem to be getting sucked into an orbit around a specific point, and getting sucked inwards to that point - like a black hole. That point, in mathematical terms, is called an attractor.
More interesting behaviour!
Let's try c = 0.3 + 0.5i.
This time the orbit is more sustained and has a larger shape. Another kind of behaviour - all from the innocent looking x2 + c.
What could a map of this behaviour look like?
The following shows an early plot created in 1978!
The map isn't a circle or a square, an oval or a diamond. It is a strange beetle shape!
Again - this strangeness from the innocent x2 + c function!
Here is a higher-resolution plot of the map, showing which numbers explode and which fall towards zero.
Finally ... the famous Mandelbrot Set.
We can see self-similarity in the pattern. There are smaller bulbs on the main bulbs, and each one of those has smaller bulbs too.
Let's remind ourselves how the image is created:
We pick a point on the 2-d map to test. We push that number as c through the function x2 + c, repeatedly feeding the answer back into the function. If the numbers get larger and larger we colour the point white. If the numbers fall towards zero, we colour them black.
We saw earlier that sometimes the numbers seem to orbit around a point, not exploding or diminishing. These are at the boundary of that beetle, dividing the two kinds of regions.
The most popular renditions of the Mandelbrot fractal are coloured. There are many options for choosing how to colour the fractal, but the following is a popular option:
We still colour black the regions that fall towards zero. For the regions that explode, we identify how fast the numbers grow and use this rate to choose a colour.
When calculating the numbers, we can stop if the magnitude get's larger than 2. There is a mathematical proof that shows that if a number get's larger than 2, then it will escape.
We also set a maximum for the number of times we iterate the function because we don't have all the time in the world to see if a point diverges or converges. If the size reaches 2 before this maximum is reached, we can use the actual iteration count as a measure of how fast the number escapes, which we can use for the colouring.
The fractal is infinitely detailed, and we can set the "window" size to see the detail more closely.
That simple zooming-in reveals an incredible amount of beautiful detail - all from that very simple function!
The following youtube video shows an animated zooming into the Mandelbrot fractal ... the level of detail is breathtaking!
You can find commented Python code to draw a Mandelbrot set here:
We were lucky to have Brod Ross show some of the worlds he creates using tools which create an almost photorealistic rendering of scenes containing objects that are fractals creates in basically the same way as the Mandelbrot and Julia sets.
Here are some of his works:
If you look closely, you can see the fractal nature of the structures.
Tools
If you want to use tools to explore these fractals, the following are good starting points: