- Several preset periodic orbits: the classic Figure-8, plus newly discovered 3D solutions from Li and Liao's recent database of 10,000+ orbits (https://arxiv.org/html/2508.08568v1)
- Full 3D camera controls (rotate/pan/zoom) with body-following mode
- Force and velocity vector visualization
- Timeline scrubbing to explore the full orbital period
The 3D presets are particularly interesting. Try "O₂(1.2)" or "Piano O₆(0.6)" from the Load Presets menu to see configurations where bodies weave in and out of the orbital plane. Most browser simulators I've seen have been 2D.Built with Three.js. Open to suggestions for additional presets or features!
Oh this brings memories. I have tried to create a little bit of 3D→2D renderer in TP 6.0 but precision was never enough for nodes to not fall apart and 80286 speed was too slow to render anything meaningful except maybe a cube.
The force falls off as the inverse square of distance in both cases. So they are essentially the same problem. Except that charge can attract or repel and gravity (as far as we know) only attracts.
Relating any of this to the big bang is not appropriate at all.
https://lweb.cfa.harvard.edu/seuforum/questions/#:~:text=EVO...
Sometimes "universe" is used to mean our observable universe (the part of the universe cut out by our past light cone), which is finite in size. The size of the portion of the whole universe that is our observable universe can be extrapolated back towards the Big Bang, and it would have had a radius of about 10 light years at 1 second after the Big Bang, or a radius of 1 AU (distance of the Earth from the sun) at 1 picosecond after the Big Bang. But again, that's only an arbitrary portion of the whole universe that happens to correspond to what is observable to us (where light had had enough time to reach us). The whole universe, on the other hand, if infinite in size, would still have been infinite in size all the way back to the 10^-43 seconds or so where our physics break down.
As an analogy, if you take the real number line (from minus infinity to plus infinity), and divide all numbers on it by 10 (basically compress it by factor 10), then it would still be an infinite line. No matter how often you repeat that division, and compress the numbers closer and closer together, the line would never become a point, it would always stay an infinite line. Only when you consider a finite segment on the line, for example [1, 2] (the interval from 1 to 2), then that interval would become [0.1, 0.2] by the division, and then [0.01, 0.02], [0.001, 0.002], and so on, and would approach becoming a single point in the limit. But, back to the Big Bang, we don't know what happened at the limit, and the whole universe is more than just the one segment.
One aspect in which the above analogy is misleading is that the universe has no “middle point”, the way the number line has a zero point. The expansion happens equally at every place in the universe. There is no absolute coordinate system relative to which it could happen. It's more like an infinite graph paper you zoom in and out from. The zooming is independent from where you imagine doing the zoom; it zooms as a whole.
I think I found a bug: after pausing, moving a body and unpausing, I cannot move the camera. Changing "follow" to something and back to "none" helps.
One idea for later might be a few preset systems, such as Alpha Centauri or other known three-body systems. It would give people a quick way to drop into something real before they start making chaos of their own.
Anyway, cracking project.
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
> this model of gravity fully-derived from [~~the Standard Model~~ QFT] also predicts perihelion in the orbit of planet Mercury.
And also:
>> "Perihelion precession of planetary orbits solved from quantum field theory" (2025) https://arxiv.org/abs/2506.14447 .. https://news.ycombinator.com/item?id=45220460
Planetary orbits are an n-body problem. GR, SQG, and Gravity from QFT solve for planetary orbits
I did something similar, mostly 2D here:
https://www.nhatcher.com/three-body-periodic/
(Mine is just unfinished)
In the avobed shared you can go to the settings a pick an integrator. I did the integrators in wasm although I suspect js is just as fast.
Color me impressed! I love the ammount of settings you can play with. I still need to understand what happens whe yu add more bodies though.
The orbits are computed in real time, so yeah what you are seeing (modulo errors in my code is genuine)
There are some caveats though. Some orbits are periodic only in a rotating frame of reference.
EDIT: you can share the URL and I can see which orbits you are talking about
Like: https://www.nhatcher.com/three-body-periodic/?class=bhh_sate...
Were you by any chance inspired to make this because of the three body series by Cixin Liu? Or were you moreso just inspired because the simulation/math/physics are interesting?
Simulating a four-body problem from the point of view of a telluric planet being juggled around by three stars. It's supposed to emulate the evolution of trisolarans from the "Three Body Problem" novel by Liu Cixin.
It’s one of those things that seems so obvious and yet actually seeing it is a really important step in understanding.
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.
Anaglyphic (red/cyan) 3D rendering would be nice. I've created a lot of anaglyphic 3D apps over the years, but they're no longer very popular -- I suspect it's the goofy glasses one must acquire and wear.
But a true 3D view of an orbital simulator like this greatly increases its impact and tutorial value.
I think adding third-dimension data would solve or mitigate the other issues, because full-color anaglyphs are possible, although at a reduced degree of subjective separation between the views.
Thanks for pointing out to me that an anaglyphic option is present, which I managed not to notice the first time.
Anyway, with third-dimension data, the anaglyph option ought to work -- for hard-core, old-fashioned red-blue eyeglass wearers. :)
There's some math at the bottom of my matplotlib extension for anaglyphs if you want to play around: https://github.com/scottshambaugh/mpl_stereo
Thanks! The 3D presets work, they provide good anaglyphic results. I didn't notice the presets option on my first visit.
So ... nice! Even with colors enabled, the 3D effect is clearly visible with red/cyan glasses.
Anyway, it's a nice online resource.
Most of the random data sets that I ran ended up with a two body system, where the third body was flung far into space never to return. However, some of these were misleading. I had one running for 15 minutes at 5x, and the third body did eventually return.
That's not misleading. Real three-body orbital systems show this same behavior. Consider that such a system must obey energy conservation, so only a few extreme edge cases lose one of its members permanently (not impossible, just unlikely).
Ironically, because computer simulators are based on numerical DE solvers, they sometimes show outcomes that a real orbital system wouldn't/couldn't.
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.
I've been working on some n-body code too, currently native only though: https://www.youtube.com/watch?v=rmyA9AE3hzM
Maybe that is what the 'softening' parameter relates to?
one issue i have always had with the n-body calculations is how can you be sure there is exactly n?
Amd this does seem predictable, I saw this for almost a minute
N-body problems for N>3 do not have exact, closed form solutions. For N=2 the solution is an ellipse. For N=3+ there is no equation you can write down that you can just plug in t and get any future value for the state of the system.
But that is NOT the same as saying it is unpredictable. It is perfectly predictable. You just have to use one of the many numerical solutions for integrating ODEs.
A three-body orbital problem is an example of a chaotic system, meaning a system extraordinarily sensitive to initial conditions. So no, not unpredictable in the classical sense, because you can always get the same result for the same initial conditions, but it's a system very sensitive to initial settings.
> Amd this does seem predictable, I saw this for almost a minute
The fact that it remains calculable indefinitely isn't evidence that it's predictable in advance -- consider the solar system, which technically is also a chaotic system (as is any orbital system with more than two bodies).
For example, when we spot a new asteroid, we can make calculations about its future path, but those are just estimates of future behavior. Such estimates have a time horizon, after which we can no longer offer reliable assurances about its future path.
You mentioned the TV series. The story is pretty realistic about what a civilization would face if trapped in a three-solar-body system, because the system would have a time horizon past which predictions would become less and less reliable.
I especially like the Three Body Problem series because, unlike most sci-fi, it includes accurate science -- at least in places.
Those are not stable solutions. Remember that Earth's moon only came into existence because of a collision with a protoplanet in the past, and if a large enough body passed close by in the future, we might lose our moon -- all because of the complexity of orbital systems with more than two members.
> (or any other planetary moon in the solar system)
There are any number of examples of planets gaining and/or losing moons because of multi-body orbital complexity.
Let me clarify something. A "three body problem" system is any orbital system with more than two bodies. The term "three-body problem" certainly doesn't mean systems with only three bodies.
> A tidally locked system with periodic resonance is permanently stable in the absence of external forces.
No. In an orbital system with more than two bodies, external forces are the name of the game. For such a system, the expression "permanently stable" cannot apply. Such a system is not open to a closed-form solution and all such systems must be modeled numerically.
Closed-form solutions are available for orbits with two bodies, and can sometimes approximate the behavior of systems with more than two, but the reliability of such a model degrades rapidly as time increases, until the predictions become meaningless.
From https://en.wikipedia.org/wiki/Orbit_of_the_Moon : "The properties of the orbit described in this section are approximations. The Moon's orbit around Earth has many variations (perturbations) due to the gravitational attraction of the Sun and planets, the study of which [ ... ] has a long history."
https://www.stochasticlifestyle.com/how-chaotic-is-chaos-how...
The corresponding series converges extremely slowly. That is, obtaining a value of meaningful precision requires so many terms that this solution is of little practical use. Indeed, in 1930, David Beloriszky calculated that if Sundman's series were to be used for astronomical observations, then the computations would involve at least 10^8000000 terms.
Well we could speed up that simulation pretty easily, just arrange the actual masses and velocities somewhere...
Then I thought, is there a way to scale the distances, masses and velocities to create a system with the same, but proportionally faster behavior?
One guess as to perhaps why not: As distances get small, normal matter bodies will get close enough to actually collide. Perhaps some tiny primordial black holes would be useful.
Computing the trajectory of a 3 body problem is a comparatively simple task.
The two grains of truth are that the solutions for most starting conditions are not analytic, roughly meaning that they can not be expressed in terms of functions. The other being that the numerical solution to an ODE diverges exponentially.
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-form solutions for orbital problem in this class, so an LLM wouldn't be able to provide one.