How does something simple produce something genuinely complex?
Not complicated in the way a tax form is complicated, where the complexity is just a pile of rules layered on top of each other. Complex in the sense that you could study the output for years and still not fully explain where it came from, even though the rule that produced it fits on one line.
This is what fractals show you. And more specifically, it is what one particular family of fractals shows you, because all four of them come from this same equation:
$$ z_{n+1} = z_n^2 + c $$
If you haven't seen this kind of notation before, don't worry, it's simpler than it looks. z and c are just numbers. You pick a value for c, start z at zero, then run the equation over and over. Each time, you square whatever z currently is and add c to it. The result becomes the new z. Then you do it again. And again. Maybe a thousand times.
That's it. That is literally the whole thing. What you get out depends entirely on what question you ask going in, and the four images below are four different answers to four different questions.
The Mandelbrot Set
The Mandelbrot set is built around one question - does z stay small forever, or does it eventually grow without limit?
When you run z = z² + c over and over, one of two things happens. Either z keeps bouncing around near zero, staying manageable no matter how many times you iterate. Or it slowly (sometimes quickly) starts growing, and once it starts growing it doesn't stop, it just gets bigger and bigger until it's effectively infinite. That second behavior is what people mean when they say a point "escapes." It escaped the boundary. It ran away.
Now, the question is, which values of c cause z to escape, and which ones don't?
For some values of c, z escapes almost immediately, like within the first five or ten iterations. For others, it takes hundreds of iterations before z finally gives up and starts growing. And for the values in the black region of the image, z never escapes no matter how long you run it. Those are the points that belong to the Mandelbrot set.
The colors outside the black region are showing you how quickly each point escaped. Slow escape gets one color, fast escape gets another. That is where all the visual structure comes from, nothing else.
What makes this genuinely strange is the boundary between "escapes" and "doesn't escape." That edge is infinitely detailed. You can zoom into any part of it and find new structure that wasn't visible at the previous scale. Spirals that contain smaller copies of the whole set. Filaments that branch into even smaller filaments. It never flattens out or becomes simple no matter how deep you go. And all of that comes from one squaring operation, repeated.
Why this connects to machine learning: A neural network does something structurally similar to this. You take a simple operation, stack it many many times, and the boundary the network learns between "yes" and "no" (its decision boundary) ends up extraordinarily complicated. Nobody designed that complexity in, it came from the iteration. The Mandelbrot set is the clearest visual proof that this isn't weird or suspicious. Its just what happens when you repeat simple rules enough times.
Julia Sets
The Julia set uses the exact same equation but asks a different question.
In the Mandelbrot, c changes with every pixel and z always starts at zero. You're essentially asking for each value of c, does zero escape or not? In the Julia set you flip it. c is fixed, you pick one value and lock it in. Then you ask which starting values of z stay bounded under that fixed rule?
So instead of testing every possible c, your now testing every possible starting point for z. Same equation, different variable in the driver's seat.
Pick c = -0.7269 + 0.1889i and you get the image above. Pick c = -0.4 - 0.6i and you get something that looks completely different in structure and character. Move c by even a tiny amount in any direction and the fractal changes again, sometimes dramatically.
There is a precise relationship between the two. Every single point on the Mandelbrot set corresponds to a distinct Julia set shape. The Mandelbrot is basically a map of all possible Julia sets compressed into one image. Points inside the Mandelbrot produce Julia sets that are one connected piece. Points outside produce Julia sets that shatter into disconnected islands.
Why this connects to machine learning: This kind of extreme sensitivity to a single number shows up constantly in model training. Change your learning rate by a small amount, or tweak your regularization slightly, and you can end up with a model that behaves in totally different ways, not just a bit better or worse. The Julia set makes that feel very concrete. A tiny shift in c and your looking at a different universe.
There's also a harder version of this idea. Adversarial examples are inputs that have been modified by tiny, often invisible amounts, and they cause a model to make completely wrong predictions. This happens because the model's decision surface has Julia-like geometry, where the space is continuous, but there are invisible boundaries in it where the classification flips entirely. Cross one of those boundaries by a single pixel and the model sees something different.
The Burning Ship
This one is less well known and worth paying attention to.
The Burning Ship fractal changes exactly one thing about the Mandelbrot iteration. Before squaring z, it takes both components of z and forces them to be positive:
$$ z_{n+1} = \left( |\text{Re}(z_n)| + i|\text{Im}(z_n)| \right)^2 + c $$
A quick note on notation - numbers like these have two parts, a real part and an imaginary part (that's the i). Re(z) just means "the real part of z" and Im(z) means "the imaginary part." The vertical bars mean absolute value, so just make whatever's inside them positive. That's all that's happening here.
That is the only change from the Mandelbrot. One absolute value, applied to each component before squaring. The result is a shape that shares no obvious visual DNA with the Mandelbrot at all. The symmetry is gone. In its place is something that looks like a ship on fire, with identifiable masts and a hull shape sitting in the lower half of the plane. Which is how it got its name.
The modification that produced this is smaller than any tweak you would make when training a model. One structural change to one step.
Why this connects to machine learning: Architectural decisions in neural networks are not just settings you tune, they are structural changes to the computation. Residual connections in ResNets, the self-attention mechanism in transformers, gating in LSTMs... each of these is a structural modification to the basic iteration, and each produces qualitatively different capabilities. The Burning Ship is a useful thing to keep in mind when someone argues that two architectures are basically the same thing. Sometimes one change really does change everything.
The Buddhabrot
The Buddhabrot, discovered by Melinda Green in 1993, doesn't ask whether a point escapes. It asks where the point went before it escaped.
The process works like this. You sample millions of random starting points for c. You throw away any that never escape, since those belong to the Mandelbrot interior and their paths aren't useful here. For every point that does escape, you record the entire path that z took during all its iterations before the escape happened. Then you take all those paths from all those millions of points and you pile them on top of each other into a single density map. Regions that many orbits passed through on there way to escaping become bright. Regions that orbits rarely visited stay dark.
The result at high enough resolution looks like a seated meditating figure. That is not coded into the math anywhere. It appears purely because of where orbits happen to travel in the complex plane under this particular iteration. Melinda Green named it the Buddhabrot because of the resemblance. The equation itself has no opinion on the matter.
Why this connects to machine learning: Attention maps in transformer models work on a similar principle. A transformer doesn't just record the final output for each word in a sentence. It records which other words each word paid attention to while being processed. If you visualize where attention consistently flows across millions of examples, you get something like a learned Buddhabrot - a density map of what the model found worth routing through, not just what it output at the end.
There's also a connection to how diffusion models generate images. The final image isn't drawn directly from the models weights. It emerges from the accumulated effect of a denoising process applied step by step, dozens or hundreds of times. The image lives in the process, not in any single output. The Buddhabrot works the same way. What you see is the side effect of millions of orbits, not something that was ever explicitly drawn or specified anywhere.
The Perlin Landscape
Strictly speaking, the fractals above are deterministic. You put in the exact same numbers, you get the exact same shape every time. Fractal noise, on the other hand, introduces randomness into the equation, but it does so in a strictly controlled hierarchical way.
The foundation is Perlin noise, created by Ken Perlin in 1983. A single layer of Perlin noise doesn't look like much, it is just a blurry, cloudy grayscale image. Amazing thing happens when you layer it using a technique called Fractal Brownian Motion (fBm).
You take your base noise, which creates large, smooth, rolling hills. Then you add a second layer of noise, zoomed out so the details are smaller, and you reduce its impact (its amplitude). This adds boulders. You add a third layer, smaller still, for rocks. Then a fourth for pebbles. The math for this layering process looks like this:
$$ f(x) = \sum_{i=0}^{n-1} a^i \text{noise}(b^i x) $$
Here, a is the persistence (how much each progressively smaller layer matters) and b is the lacunarity (how fast the frequency increases).
Video games such as Red Dead Redemption 2 provide a real-world instance of this equation at work. Rockstar's technical artists couldn't hand-sculpt a map that large, so they generated its heightmaps procedurally. Low-frequency noise laid down the mountain ranges and plains and each higher-frequency layer added finer terrain detail on top, exactly as f(x) describes above.
Why this connects to machine learning: Some image generating AI builds pictures the same coarse to fine way. StyleGAN, a model built for generating realistic faces, adds randomness at several stages while building an image. Early stages set big things like the general shape of the face, later stages add small stuff like individual hair strands and skin texture. Rough shape first, fine detail stacked on after, same idea as the terrain.
Diffusion models, the kind behind most AI image generators, often do something similar... they build a small, rough version of the image first, then sharpen it in passes. This pattern shows up even where nobody designed it that way on purpose, too. A neural network trained just to recognize what is in a photo ends up organizing itself the same way on its own, early layers pick up big basic shapes and colors, deeper layers pick up fine texture and edges. Nobody tells it to work like that, it's just the easiest way to make sense of a picture, the same reason Perlin reached for it in 1983.
The Part That Is Actually Useful
Beyond the visuals, fractal geometry gives you a concrete tool for measuring how rough or irregular a signal is. The idea is called fractal dimension. A perfectly smooth curve has a dimension of 1. A flat plane has a dimension of 2. The edge of the Mandelbrot set sits close to 2, because it packs so much detail into every scale. Real world signals sit somewhere in between those extremes.
This matters for a few practical things.
Anomaly detection. Systems that are behaving normally tend to have consistent fractal properties over time. When those properties shift suddenly, it often means something in the underlying process changed. This gets used in industrial monitoring, where a change in the fractal dimension of a sensor reading can flag equipment wear before anything visibly breaks. It also shows up in cybersecurity, where unusual fractal structure in network traffic can be a early signal of an intrusion.
Time series features. When you're trying to classify signals like heartbeat rhythms or market behavior, the fractal dimension of a window of data can carry information that basic statistics miss entirely. Its a feature you can compute and hand to any standard model.
Checking generative models. There's growing interest in using fractal metrics to check whether images or text produced by a generative model have the same statistical self-similarity as real data. A model can score well on standard evaluation metrics while still missing something structural about the distribution it was trained on. Fractal dimension is one way to look for that gap.
The Part Worth Sitting With
Large language models and deep networks keep surprising the people who build them. Capabilities appear that weren't explicitly trained for. Internal structure forms that nobody designed. There's a lot of mysticism that gets attached to this, but the fractal parallel makes it feel less mysterious.
The Mandelbrot set doesn't have it's characteristic shape because someone drew it that way. That shape is there because the iteration dynamics of z = z² + c produce a region of stability whose boundary happens to have that form. The structure is a consequence of the rule. Nobody planned it.
Neural networks are similar. The rule is to minimize this loss, adjust these weights, repeat. What emerges from doing that millions of times on a large dataset is not predictable from the rule alone. The structure is real, the rule is simple, and the gap between them is where interpretability research is trying to work.
The honest position is that we study that structure the same way mathematicians study fractals, which is by running the process many times and looking carefully at what accumulates. You can't derive the Buddhabrot analytically. You simulate it and observe. Mechanistic interpretability is doing something structurally identical, running the network across many inputs and observing which parts activate, which features form, which paths consistently matter.
The equation is short. What it produces is not.
The Code
All four fractals are in a single R file with consistent output settings 1200x1200 pixels, black background, no margins, perceptually uniform color palettes from the viridis package. The Mandelbrot, Julia, and Burning Ship use vectorized matrix operations in pure R. The Buddhabrot uses C++ via Rcpp with parallel workers, since tracking millions of orbits at 1,500 iterations each is not something R handles gracefully on its own.
Source: mandelbrot_family.R