Build your own universe

Back in April 2020 Stephen Wolfram published a very long post saying he might have found a path to a fundamental theory of physics. I've been a bit obsessed with it ever since.

The post was full of pictures of networks growing out of tiny rules. They were beautiful, but they were static, and I kept wanting to grab one and give it a poke, or apply the rule one more time and see what happened.

So I built some pictures you can poke. Here's the first one.

Interactive demo: a network of about 260 dots and arrows grown from a single rule. You can drag dots, click them to see their relations, press Grow to run the rule again, or play it from the very beginning.

That whole thing grew from one element with two loops on it and a single rule, applied over and over. That's it, nothing else was put in.

To be totally honest with you, this is Wolfram's hypothesis about how the universe might work. It isn't established physics, plenty of physicists are sceptical of it, and I'm not a physicist either. I just find it fascinating, and once you can poke at it, the ideas turn out to be a lot less scary than they look.

So all the way through, I'll put a little label next to each claim to say how sure we can be about it:

  • in the demo You can see it happen right here. My code computes it.
  • maths, if… Someone has proved it mathematically, as long as certain assumptions hold.
  • proposed Wolfram's suggestion for how a bit of the model matches real physics.
  • observed Real physics, established by experiment.

In this first part we're going to build space. By the end you'll have grown a universe like the one above and measured how many dimensions it has. Part 2 is all about time.

Here's the idea I want to keep coming back to. A normal physics model gets handed a bunch of stuff up front, like coordinates and a clock ticking away in the background. This one doesn't get any of that, so it has to make it all from the rule. Each chapter we'll catch ourselves assuming something, and then watch it come out of the rule instead.

Why rules?

If you've come across Wolfram before, it's probably from his work on cellular automata like this one, called rule 30. Each row is made from the row above using a tiny rule that only looks at a cell and its two neighbours, and yet the pattern never settles into anything you could easily predict.

Interactive demo: rule 30, a row of cells where each new row is computed from the one above. A single black cell grows into a triangle with a chaotic, random-looking pattern inside.

His whole career has been about simple rules doing complicated things. The physics project takes that a step further and asks what happens if the universe is like that, except nobody gave it a grid to live on.

01What is space made of, if not positions?

Let's start with the stuff the universe is made of. In Wolfram's model there are just elements. You can think of them as atoms of space, and each one is completely featureless. It has no position, no size and no colour. The only thing you can say about an element is which other elements it's related to.

A relation is a tiny list like {1,2}, which says element 1 is related to element 2. The order matters, so {1,2} isn't the same as {2,1}, which is why I draw it as an arrow.

The whole universe, at any moment, is just a big list of these. Here's a small one. Try adding a relation by typing something like {4,6}, and hover the rows to see which arrow is which.

Interactive demo: a list of relations such as {1,2} and {2,3} on the left and a drawing of them on the right. You can type new relations, remove them, drag the dots and shuffle the drawing.

Notice that I had to decide where to draw everything. I'm using a little physics simulation where the relations act like springs, which is why it wobbles when you add things. Press Shuffle drawing and the dots go somewhere completely different before settling down again.

But it's the same list, so it's the same universe. The drawing is just for us. In the model there's no "where" at all.

Relations can also involve more than two elements. {1,2,3} relates three elements, in that order, and I draw those as a little shaded shape with arrows going round it. Plenty of Wolfram's rules use them, and we'll meet some soon.

Here's a quick test of all that. Two of these drawings are the same network and one isn't. Can you spot the odd one out?

Interactive puzzle: three drawings of small networks, each with its list of relations. Two are the same network drawn differently; one differs by a single relation. Pick the odd one out.

So that's the first thing a normal model gets for free that this one has to do without. There are no coordinates here, we just have the list.

02What does a rule do?

A list on its own just sits there. To get a universe that actually does something, we need a rule.

A rule says: wherever you find this pattern of relations, replace it with that one. Here's about the simplest one there is, written the way Wolfram writes it: {{x,y}} → {{x,y},{y,z}}.

Read it as: find any relation and call its two elements x and y. Keep that relation, and add a new one from y to z. There's no z on the left-hand side, so z has to be a brand new element. Strictly speaking, the rule throws the old {x,y} away and puts an identical new one back, which is why it lights up green too.

Applying the rule once, at one spot, is called an event. Click any arrow to apply the rule there.

Interactive demo: the rule {{x,y}} → {{x,y},{y,z}} and a small network. Clicking a relation applies the rule there: the relation is labelled x and y, and a new element z appears with a new relation from y to z.

Okay, so clicking every arrow one at a time gets old fast. The obvious shortcut is to apply the rule everywhere it fits in one go. I'll call one of those batches a generation. It's just how I'm grouping events to draw them, not a claim that the universe updates everywhere at the same moment.

There's one subtlety. Within a generation each relation can only be used once, and anything created during the generation has to wait for the next one. Wolfram's code has a precise rule for which matches go first (roughly, the ones using the oldest relations) and grabs every match it can without reusing anything. I copied his exact ordering, which is fiddlier than it sounds, so our pictures come out the same as his.

Interactive demo: the same rule run a whole generation at a time. A table records the generation, the number of events, relations and elements; the relations double every generation and the drawing becomes a tree.

Every generation, the number of relations doubles. It's a tree, and it keeps branching forever without ever closing up into anything that looks like space. A bit boring, but hold onto it, because it comes back later.

Now for a more interesting one. This is the rule Wolfram shows off near the top of his post: {{x,y},{x,z}} → {{x,z},{x,w},{y,w},{z,w}}. The pattern this time is two relations that start from the same element.

We start with a single element that has two loops on it. That might look like it can't possibly match, but x, y and z are allowed to land on the same element. Hover the relations to see where the rule fits, and click to apply it.

Interactive demo: Wolfram's showcase rule {{x,y},{x,z}} → {{x,z},{x,w},{y,w},{z,w}} starting from one element with two loops. Hover to see matches and click to apply one event, or run whole generations and replay them with a slider.

Did you notice that applying one event can use up a relation that another match needed? Once a relation has been replaced it's gone, so any other match that wanted it can't happen any more. Hold that thought.

I find it a bit mad that a rule you could write on the back of a beer mat makes something this intricate. By generation 12 there are 1,651 elements, which is exactly the number Wolfram reports for the same rule in the demo.

I've also been sneaking something in: the Next generation button. Grabbing every match I can in one batch, oldest first, is a handy way to group events up. It's not the only way, and in Part 2 we'll find out it was a much bigger choice than it looks.

03Can any rule make space?

Wolfram and his team didn't just try one rule, they ran enormous numbers of them. Most do something boring: they stop after a few events, or grow trees, or tangle up into a blob. A few make something that looks surprisingly like a surface.

Here's a little zoo. See if you can find one that makes something flat, like a sheet. When you find one you like, press Keep this one and we'll measure it in the next chapter.

Interactive demo: a grid of small rules, each drawn after a few generations. Click one to open it larger, run it further, and keep it to measure in the next chapter.

Exploring rules like this is what Wolfram calls ruliology. The thing that gets me is that nobody told those sheet-making rules about two dimensions. There's nothing in them about flatness, and nobody handed them a sheet to live on, they just make one.

04How many dimensions does it have?

So some of these look like surfaces. But "looks like" is doing a lot of work there, and we already know the drawing is made up. Is there a way to measure the dimension of a network without looking at a drawing at all?

There is, and I think it's lovely. Pick an element and count how many elements are within 1 hop of it, then 2 hops, then 3, and so on. On a line that count grows like r. On a flat grid it grows like r², and in 3D like r³. So the dimension is the power: how fast a ball grows as you make it bigger.

Click any element to move the centre of the ball there, and drag the radius.

Interactive demo: pick a space (a line, a grid, a 3D lattice, a tree, or a network grown from a rule). Choose a centre and a radius to light up a ball of elements; a chart plots how fast the ball grows, which gives the dimension.

The slope wobbles at small radii because the network is lumpy up close, and it bends over at big radii when the ball hits the edge of what we've grown, so I've shaded those bits and averaged over several centres.

Try Shuffle drawing and measure again. You get exactly the same numbers, because we're counting hops, not measuring the drawing. Then try the tree from earlier. Its slope never settles, it just keeps climbing, so a tree doesn't have a dimension at all. That's a big part of why it doesn't look like space.

The knitting rule creeps up towards 2 as you grow it. Nobody put a 2 in that rule anywhere, it's just what you get when you measure what it made. The showcase rule creeps up too, past 2.4 by the time it's as big as I'll let it get here, and Wolfram's estimate for much bigger versions is about 2.7. So dimension doesn't have to be a whole number here, and it can drift as the universe grows in the demo.

For our universe we'd want a rule whose dimension settles on 3 when you zoom out, along with everything else physics needs. Wolfram's suggestion is that such a rule exists and that space really is like this underneath proposed. Nobody has found that rule yet.

END OF PART 1What we've built so far

So what have we got? A universe that is nothing but a list of relations, a rule that rewrites it, and space that comes out of it with a dimension we can measure from the inside. We never handed it coordinates or a number of dimensions. It made them.

I've also been quietly cheating the whole way through. Every time you pressed Next generation, I picked an order for the events. Part 2 pulls on that thread, and it takes us to time, cause and effect, relativity and some very strange branching graphs.

If you'd like to play first, the playground has every rule from this page, plus whatever you kept from the zoo. Otherwise, grab another cup of tea and I'll see you in Part 2.