Per Møldrup-Dalum

Vibe Scratching an Old Itch — The 3-Body Problem

When I got my first computer [add link to "My Computers"]*, my earliest projects were about simulating bits of the real world — using code to understand math and nature. My first computer game was Fighter Pilot for the ZX Spectrum, because I wanted to fly — but also because it was a simulation.

At university, I mostly focused on using computers to understand the physical world — chemistry and physics. My master’s thesis was about building a quantum model to optimize something called polarization transfer between two kinds of atoms in solids, so that we could better observe the rarer of the two.

After university, I shifted to software development, building programs that help people make computers do things for them...

Over the past decade, my focus has again been on simulation and data analysis — mostly data centeret. I've built systems for exploring and analyzing data, but also doing the analysis myself. So, I haven’t done much simulation work in years, apart from the occasional fooling around [link to why that is important]. I’ve always had an eye on others doing cool simulations, thinking: “Yeah… I want to do that too.”

Then, the other day, a few streams crossed and I ended up vibe-coding a visualization of the Lorenz attractor. I was genuinely impressed with how it turned out — thanks, GPT-5!

So, yesterday I thought: why not make my own three-body simulation? I’ve been following the Random Three-Body Problem bot on Mastodon for a while and love those simulations. I’ve also played with their Julia implementation before and even experimented with porting it to Wolfram Language. Both worked fine — but my Lorenz attractor experiment reminded me how much an LLM can actually help, and how powerful JavaScript and the browser have become for visualization.

Also, being a fan of The Three-Body Problem by Liu Cixin might have helped in the subconscious decision...

So I started a chat with GPT-5, fired up WebStorm, and about ten hours later I had this: A Three-Body + One Simulator — complete with a head-up display, JSON import/export for initial conditions, and collision + escape detection. If you want to play with the code, it's on GitHub: 3-body-plus-one

3-body
The 3-body simulation

Future Work

The simulation looks great and works fine, but I honestly don’t know if it’s physically correct. The next step would be to compare it against trusted models — probably something I would build in The Wolfram Language. That stage would focus more on correctness than on visuals. Could be fun.

Better visuals, improve how the bodies are drawn and make it easier to differentiate between them. Also, I suspect the relative sizes of the bodies are wrong.

Also… I now have around 1,000 lines of JavaScript that I can use to actually learn JavaScript 🤷‍♂️

Another idea: run thousands of simulations with random initial conditions and see how well a machine learning model can predict outcomes. Basically, explore the complex-systems domain with ML. I’ve read some great Wolfram Language articles by Stephen Wolfram on that — might give a lot of late evening fun.

TIL

What did I actually learn today?