One thing I'd never really considered before is how frequently bodies get ejected at high speed from the simulation, especially as the number of initial bodies is increased. Suddenly made me realise that the "big bang" which previously seemed a bit of a random and magical theory (obvious question is why would the universe be expanding from a single point when gravity would be immense) now seems a lot more plausible w…
Show HN: Browser-based interactive 3D Three-Body problem simulator
111–119 of 119 posts
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#112Earlier quoted context omitted.
The universe didn’t expand from a single point in the Big Bang, that’s a common misconception: https://lweb.cfa.harvard.edu/seuforum/faq.htm#m9 https://lweb.cfa.harvard.edu/seuforum/questions/#:~:text=EVO... https://ned.ipac.caltech.edu/level5/Peacock/Peacock3_3.html
Would it be incorrect to say the universe was a single point at one time? That's been my layman's understanding - the universe at the start was infinitesimally small (a point) and has been expanding since.
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.
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#113Tried writing an electrostatic particle simulator in Turbo Pascal 7 with BGI as a teen, a handful of particles before it crawled. Then saw a galaxy collision sim on a CD-ROM magazine disc handling thousands of bodies smoothly. Thought it was assembly tricks.. now I'm sure it's algorithmic (avoiding N**2 runtime) but never dug into the specifics. Are charges vs gravity sims essentially the same n-body problem?
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.
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#114Earlier quoted context omitted.
Thanks! I tried the anaglyphic option, but the data being provided to the engine doesn't include third dimension data (so the orbits are essentially flat in the third dimension). Also the orbital colors interfere with the anaglyphic effect (which normally expects white graphic data that it then splits into red and cyan). I think adding third-dimension data would solve or mitigate the other issues, because full-color…
I just added that option. It wasn’t there when you initially looked :). Are you using one of the 3D presets/random config or are you using a 2D preset? I'll order a set of glasses so I can test. Not very familiar with this so would be fun to experiment.
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
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#115Earlier quoted context omitted.
> There are stable solutions. See: Earth’s Moon (or any other planetary moon in the solar system). 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 plane…
If you are presupposing external perturbations or collisions, it's not an N=3 system... we're talking about the three body problem. A tidally locked system with periodic resonance is permanently stable in the absence of external forces.
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."
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#116Earlier quoted context omitted.
Thanks! I tried the anaglyphic option, but the data being provided to the engine doesn't include third dimension data (so the orbits are essentially flat in the third dimension). Also the orbital colors interfere with the anaglyphic effect (which normally expects white graphic data that it then splits into red and cyan). I think adding third-dimension data would solve or mitigate the other issues, because full-color…
I just added that option. It wasn’t there when you initially looked :). Are you using one of the 3D presets/random config or are you using a 2D preset? I'll order a set of glasses so I can test. Not very familiar with this so would be fun to experiment.
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.
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#117Will 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 a…
> 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
Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#118Re: Show HN: Browser-based interactive 3D Three-Body problem simulator
#119Tried writing an electrostatic particle simulator in Turbo Pascal 7 with BGI as a teen, a handful of particles before it crawled. Then saw a galaxy collision sim on a CD-ROM magazine disc handling thousands of bodies smoothly. Thought it was assembly tricks.. now I'm sure it's algorithmic (avoiding N**2 runtime) but never dug into the specifics. Are charges vs gravity sims essentially the same n-body problem?
(a) There's a method that works well for monopolar sources (gravitational + electrostatic particles) called the Barnes-Hut method. You effectively divide space up into a quadtree (2D) or octree (3D), and in each cell work out the center of mass / total charge. You make particles in "nearby" cells (using a distance criterion that can be adjusted to speed up/slow down the simulation in a trade off with accuracy) interact directly, and far away cells you just use the center of mass to work out the interaction between any given 'far' particle and the particles in that cell. The method is O(N log N) but in practice, this is 'good enough' for many applications.
(b) uses a more rigorous technique called the Fast Multipole Method which is O(N), where rather than just using the center of mass or sum of charges, you expand the potential from particles out into higher order components which captures the distribution of particles within each cell. This also means you can capture more complex potentials. The downside is that this is a nightmare to implement in comparison to the Barnes-Hut method. Each cell has it's own multipole expansion, and it is 'transferred' to work out the additive contribution to every 'far' cell, calculating a 'local' expansion. Typically people use the most compact representation of these potential expansions which uses Lagrange polynomials, but this is a pain.