Live data from Hacker News

Show HN: Browser-based interactive 3D Three-Body problem simulator

trisolarchaos.com

81–90 of 119 posts

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#82
Will this simulate the sun and planets of the solar system?

Do these models of n-body gravity predict the perihelion in the orbit of Mercury?

Newton's does not predict perihelion, GR General Relativity does, Fedi's SQG Superfluid Quantum Gravity with Gross-Pitaevskii does, and this model of gravity fully-derived from the Standard Model also predicts perihelion in the orbit of planet Mercury.

Lagrange points like L1 and L2 are calculated without consideration for the mass of the moon.

Additional notes on n-body mechanics: https://westurner.github.io/hnlog/#comment-45928486 Ctrl-f n-body, perihelion

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#83
post #81

My dumb question: I thought the whole thing with this is the instability/inability to predict. It starts off with the three bodies locked in to fixed motions? I guess it has to be for the user to start messing around with it?

Not a dumb question at all!

There is no general closed-form solution to the three-body problem. There are certain specific initial conditions which give periodic, repeating orbits. But they are almost always highly "unstable", in the sense that any tiny perturbations will eventually get amplified and cause the periodic symmetry to break.

It's analogous to balancing an object on a sharp point. Mathematically, you can imagine that if the object's center of gravity was perfectly balanced over the point, then there would be zero net force and it would stay there forever. But the math will also tell you that any tiny deviation from perfect balance will cause the object to fall over. It's an equilibrium, but not a stable equilibrium.

The example at the link demonstrates this. The numerical integration can't be perfectly accurate, due to both the finite time steps and the effects of floating-point rounding. Initially the error is much too small to see, and the orbits seem to perfectly repeat. But if you wait a couple of minutes, the deviations get bigger and bigger until the system falls apart into chaos.

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#84
post #81

My dumb question: I thought the whole thing with this is the instability/inability to predict. It starts off with the three bodies locked in to fixed motions? I guess it has to be for the user to start messing around with it?

Not a dumb question at all! There is no general closed-form solution to the three-body problem. There are certain specific initial conditions which give periodic, repeating orbits. But they are almost always highly "unstable", in the sense that any tiny perturbations will eventually get amplified and cause the periodic symmetry to break. It's analogous to balancing an object on a sharp point. Mathematically, you can…

Ahh okay I'll let it run as is for a while and see what happens, thanks

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#85
Oh one question I have, when I messed around with ThreeJS line width was a problem, these curves look pretty nice/thick on mac, maybe that was updated recently. (lines as in orbit path)

ThreeJS is awesome btw, I exported a GDB file I think from a CAD program and imported it into ThreeJS/able to animate each part pretty cool.

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#86
post #68
post #23

Earlier quoted context omitted.

> Is this with Gemini 3? An LLM couldn't provide results for a sim like this, compared to a relatively simple numerical differential equation solver, which is how this sim works. Unless you're asking whether a sim like this could be vibe-coded, if so, the answer is yes, certainly, because the required code is relatively easy to create and test. Apart from a handful of specific solutions, there are no general closed-f…

Well I was wondering if it was vibe coded because Gemini 3 loves Three.js and that's a main selling point of the model.

This was posted as well to the vibecoding subreddit, where the OP said they used Claude Code.

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#87
post #85

Oh one question I have, when I messed around with ThreeJS line width was a problem, these curves look pretty nice/thick on mac, maybe that was updated recently. (lines as in orbit path) ThreeJS is awesome btw, I exported a GDB file I think from a CAD program and imported it into ThreeJS/able to animate each part pretty cool.

You might be using the webgl lines (LINE_STRIP), those are always thin. The other way is to build a mesh that looks like a line (which Three.js also has functions for). select the line type here to see the difference: https://threejs.org/examples/?q=lines#webgl_lines_fat

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#88
post #81

My dumb question: I thought the whole thing with this is the instability/inability to predict. It starts off with the three bodies locked in to fixed motions? I guess it has to be for the user to start messing around with it?

Not a dumb question at all! There is no general closed-form solution to the three-body problem. There are certain specific initial conditions which give periodic, repeating orbits. But they are almost always highly "unstable", in the sense that any tiny perturbations will eventually get amplified and cause the periodic symmetry to break. It's analogous to balancing an object on a sharp point. Mathematically, you can…

Not really. Any solar system proves a kind of stability. And so does the famous KAM theorem. It states that a periodic solution is indeed quasi-stable under small pertubations. And yes, small sometimes is extremely small. But still stable. Imagine a sharp point with a tiny dent.

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#89

Earlier quoted context omitted.

Some of the high speed ejections might be due to the approximations used. You can see this with a simple time-stepper when the forces get massive when 2 bodies get very close and that force is then applied for the whole timestep.

I don't doubt that the math allows for escape velocities in some interactions. But I am wondering if, realistically, tidal forces might instead shred the bodies before forces were adequate for a body to achieve escape velocity.

It might be a fun option if bodies that pass really close can merge together or tear each other apart. The latter might add a lot of complexity though.

Re: Show HN: Browser-based interactive 3D Three-Body problem simulator

#90

Excellent work. Is this based on simple Newtonian gravity applied over a uniform time-step, or something more sophisticated?

For accuracy, time step can get smaller when bodies are closer.

Yes, but this would slow the simulation right down if 2 bodies are very close. I think people sometimes use a 'fudge factor', e.g. if distance < x then treat distance as x.
Post reply on HN