15 ms·
A rudimentary simulation of the three-body problem
- Gys 3y agoIn this simulation the bodies also collide together. Luckily that never happened in the book.
- maelito 3y agoShould a collision conduct to a simulation of a 4 body problem ?
- achristmascarl 3y agothat might just be because of my low resolution gif ;)
- SamBam 3y agoI was wondering about this too, but I think they're not colliding. I think they're pulling towards each other and getting tightly pulled around each other so they end up slingshotting and flying back the way they came, in a way that looks like a bounce. You can see this in the very beginning of the simulation, with the blue and green dot. Can anyone say if this is actually accurate? It seems like an unintuitive motion to me, but I'm often surprised by how these things work.
- achristmascarl 3y agoi believe you're correct, other (higher resolution) visualizations of periodic orbits show that "wrapping" behavior more clearly. example from wikipedia: https://en.wikipedia.org/wiki/Three-body_problem#/media/File:5_4_800_36_downscaled.gif https://en.wikipedia.org/wiki/Three-body_problem#/media/File...
- CWuestefeld 3y agoThe book is mis-named. Their system was not 3 bodies, but 4 (3 stars, plus a planet). And the system is so chaotic that even that little planet will make a huge difference over time. And even beyond that, the bodies themselves were transformed, having the ability to tear atmosphere away from each other.
- marginalia_nu 3y agoChaotic N-body behavior appears when the bodies have similar mass. In that scenario, every solution is either chaotic or unstable. The solar system is strictly speaking a 20+ body system. That said, the behavior of the solar system is fairly predictable because the the sun has almost all of the mass, and jupiter has almost all of what remains, everything else is a small correction term. We can to a good approximation calculate the other satellites' orbits around either the sun or the center of mass of the sun-jupiter system.
- woooooo 3y agoLuckily??! Could have saved everyone a lot of trouble and kept them in the proper number of dimensions.
- aaronbrethorst 3y agoArguably this was all Mao Zedong's fault.
- at_compile_time 3y agoIf you want to demonstrate why the three-body problem is chaotic, you can set it up to run a couple hundred very similar simulations in parallel. Just nudge each body by a tiny amount to simulate uncertainty in the initial conditions and watch the resulting configurations diverge as tiny differences become large differences. Rather than points, you get lines of probability that stretch out and wrap around each other. It's quite striking. Edit: semantics
- jovial_cavalier 3y agoThis only demonstrates that the system is chaotic, not that there is no closed form solution.
- ncallaway 3y agoBut the chaos is extremely critical, since we can’t ever perfectly measure the initial conditions. So, even having a closed form solution isn’t helpful when computing real world situations.
- constantcrying 3y agoThe statements are independent. It having a closed form solution and it being unstable don't contradict or confirm one another. In solutions to ODEs converge very often exponentially from the true result. That the 3 Body problem for this makes it characteristic, not special. >So, even having a closed form solution isn’t helpful when computing real world situations. Simply not true. It is helpful or not depending on your problem. Often you are interested in short term behavior, which can be studied by numerical methods or, if existing, analytic solutions.
- PaulHoule 3y agoClosed form solutions in general dynamic systems are possible when systems are integrable which means there is a conserved quantity for every degree of freedom. The solar system is almost like that in the case that each planet keeps going around with a constant angular momentum so they go around like a set of clocks that run at different speeds. Over long periods of time there is angular momentum transferred by the planets so you get chaos like this https://www.aanda.org/articles/aa/full_html/2022/06/aa43327-22/aa43327-22.html https://www.aanda.org/articles/aa/full_html/2022/06/aa43327-... Orbital mechanics is a tough case for perturbation theory because each planet has three degrees of freedom (around, in and out, up and down) and the periods are the same for all of these motions and don’t vary with the orbital eccentricity or inclination. Contrast that to the generic case where the periods are all different and vary with the amplitude so with weak perturbations away from a resonance the system behaves mostly like an integrable system but if the ratio between two periods is close to rational all hell breaks loose, see https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Arnold%E2%80%93Moser_theorem https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Arnold%E2%8... the harmonic oscillator has a similar problem because the period doesn’t change as a function of the amplitude. Either way these two pedagogically important systems will lead you completely wrong in terms of understanding nonlinear dynamic, if you add, say, an εx^3 term to the force in one of two coupled harmonic oscillators it is meaningless that ε is small, you have to realize that the N=2 case of this integrable system https://en.wikipedia.org/wiki/Toda_lattice https://en.wikipedia.org/wiki/Toda_lattice is the right place to start your perturbation from which ends up explaining why the symmetry of the harmonic oscillator breaks the way that it does. Funny though, the harmonic oscillator is not weird at all in quantum mechanics and is just fine to do perturbation theory from.
- 7373737373 3y agoThere is this cool paper "Crash test for the restricted three-body problem" [0], that plots where the third body eventually ends up when dropped from any location. Looks very fractal-like [1][2] [0] https://scholar.archive.org/work/wnwgyliq5fgtba45k535t5lb5e/access/wayback/http://www.nld.ds.mpg.de/~jan/crashrtbp2.pdf https://scholar.archive.org/work/wnwgyliq5fgtba45k535t5lb5e/... [1] https://www.semanticscholar.org/paper/Crash-test-for-the-restricted-three-body-problem.-Nagler/2d2fea1fcccf769193b0a6c75adbac54d9aec76c/figure/4 https://www.semanticscholar.org/paper/Crash-test-for-the-res... [2] https://www.semanticscholar.org/paper/Crash-test-for-the-restricted-three-body-problem.-Nagler/2d2fea1fcccf769193b0a6c75adbac54d9aec76c/figure/6 https://www.semanticscholar.org/paper/Crash-test-for-the-res...
- jameshart 3y ago‘Strange attractors’: https://en.wikipedia.org/wiki/Attractor https://en.wikipedia.org/wiki/Attractor “An attractor is called strange if it has a fractal structure.”
- cl3misch 3y agoThank you for reminding me of this beautiful field of mathematics. The best textbook I've ever read: Nonlinear Dynamics and Chaos by Steven Strogatz.
- mock-possum 3y agoLooks like fluid dynamics / turbulence to me
- DrFalkyn 3y agoE&M and gravity are both n^2 forces, but E&M has polarity, whereas gravity (at least we encounter it) does not.
- antognini 3y agoIf anyone is interested in playing around with gravitational dynamics I highly recommend the REBOUND library [1]. It has a simple Python interface but under the hood it has a collection of research grade integrators. It came out around the time I was finishing up my PhD in gravitational dynamics, but if I were still in the field it's what I'd be using. If you're curious what would happen to the Solar System if you made Jupiter 10 times more massive you can pip import the library and find out for yourself in about five minutes. [1]: https://github.com/hannorein/rebound https://github.com/hannorein/rebound
- ricksunny 3y agoLooks awesome. I have a question that might be pedantic but I think you could speak to. Coming from an engineering mindset, I like the use of the term 'integrator' instead of 'solver'. In MATLAB, 'solvers' are used to iterate states of ODE models. But the term 'integrator' is more intuitive to me. Can you speak to the use of one term vs another in the ephemeris community?
- constantcrying 3y agoSolver is a general term, it is just an algorithm which solves a certain problem. You have solvers for linear systems, PDEs, optimization problems, graph problems, etc. An integrator is an algorithm which allows the numerical approximation of the solution to an ODE, given that the ODE is written in a specific form where it is equivalent to calculating the integral of multiple functions.
- dreamcompiler 3y agoYou can solve differential equations by integrating or by differentiating. Real-world integrators were easier to build back when DEs were solved with analog computers. Although "easier" is an understatement: Differentiators have a nasty habit of trying to blow up to infinity, which means you can't really build a good, general differentiator either with analog or digital electronics. Integrators are much better behaved pets and they don't shit on the carpet. So everybody uses integrators. Integrators have lots of issues too but those can be sufficiently mitigated for many classes of problems. Differentiators are mostly hopeless, feral beasts.
- JKCalhoun 3y agoAnd since A. K. Dewdney is fresh on my mind, he did a Computer Recreations article generally about this (about simulating orbital mechanics) and the clever bit that I remember: you dial the time slice way down as objects got close, you care little when the objects are far apart. Not a "solution" of course, but certainly an optimization if you're just generally doing gravitational simulations.
- PaulHoule 3y agoSee https://en.wikipedia.org/wiki/Adaptive_step_size https://en.wikipedia.org/wiki/Adaptive_step_size
- lfmunoz4 3y ago[flagged]
- acover 3y agoWhat in this post isn't honest?
- lfmunoz4 3y ago"not honest" might not be the right phrasing. What I was trying to say is that when learning this stuff I felt like they hid a lot of information from me which later surprised me. But they hid it because they have no answers for it. One simple example is what happens when you don't consider these as points but instead spheres. Also what happens when the spheres come close? The math starts breaking down, you start seeing infinities. I.e, in reality spheres come close and gravity doesn't go infinity.
- mr_mitm 3y agoYou are complaining that you study the simple cases or simplified cases first before you study near unsolvable systems? Besides, very often the simplified case gets you surprisingly far because the difference between idealized situations and reality is often negligible or at least easily describable - see perturbation theory. The simplified cases are well worth studying.
- sfink 3y agoIf I understand correctly, or at least if I map it to my own similar complaint: the problem is not that they have you study simple or simplified cases, it's that the ignored complexity is unacknowledged and sometimes even denied. Which makes a lot of sense in primary school, where even mentioning it might cause some kids to ignore everything because "it's not really how it works" or whatever. But by the time you've made it past the basics, sweeping complexity under the rug is harmful. You still want to be studying the simplified scenarios, but it would be much better if you had some sense of the range of things that meaningfully differ from realistic scenarios. Not so you can take them into account in your solutions, but so you have the appropriate level of humility about what your solutions mean and the limits of their applicability. I guess I didn't do that much physics, because for me it comes up more in other fields. In statistics, for example, it is critically important to understand the limitations of your results. For example, you might assume that error is normally distributed. You don't want to forget about that assumption, because it is very commonly violated, and it can make a large difference in your conclusions. Yet in school, it was almost always handwaved aside with "Law of Large Numbers mumble mumble mumble". Even when the law didn't apply, or the definition of "Large" happened to be "way bigger than your pathetic number of data points". It's also why there's often such a gulf between academia and industry. Academic results walk a tightrope of assumptions and preconditions, and trying to put them into practice always finds places where those don't hold. Sometimes they even start out holding, but then everybody takes advantage of it until competition drives everyone into optimizing the residuals. If there's a space where things make sense, competition will always drive you to the edge of that space. Or beyond; competitive pressure does not care about keeping your equations simple and pure. Back to the point, you might study a field for years and then land a job in exactly that field, only to discover that everybody is looking at it completely differently because they've exhausted the simplified space and are deep in the land of heuristics, guesswork, and approximation. The market for spherical steaks was saturated years before.
- xyst 3y agoNetflix really going hard on pushing their IP. It’s like guerilla marketing on steroids. I jest. Tbh, I didn’t know this was an actual problem. Thanks for sharing.
- nonfamous 3y agoThis account has been posting simulations of interesting 3-body scenarios for quite a while. It used to be on Twitter but moved to Mastodon. You can check out the archives and play the videos, it’s quite neat: https://botsin.space/@ThreeBodyBot https://botsin.space/@ThreeBodyBot
- Hugsun 3y agoI love this bot, thanks for sharing!
- hackernewds 3y agoHow is it random if the 3 body problems are chosen to have overlapping ellipses that look beautiful
- pixelesque 3y agoRejection sampling? /s
- itishappy 3y agoThe Mastodon videos have random initial conditions, the GitHub example does not. Are you checking the right link?
- rsynnott 3y agoDo you want ghost numbers counting down on your retinas? Because this is how you get ghost numbers counting down on your retinas.
- lagadu 3y agoIt's ok, I'll just make sure never to measure the CMB for variations.
- danAtElodin 3y agoNicely done! We were playing with this concept as well, in case it's useful to compare notes together: https://app.elodin.systems/sandbox/hn/three-body https://app.elodin.systems/sandbox/hn/three-body
- joe_the_user 3y agoOne of the first programs I ever wrote was a simulator for a planet rotating a star with a naive difference equation approximation to Newton's law. I was a bit disappointed to see the planet reliably spiral into the sun. The main thing is that something like Euler's method (naive iterative approximation) doesn't guarantee conservation of energy. I believe that this is why planetary dynamics are usually handled with Lagrangian equations rather than the naive approximation approach. Edit: It would be nice to see what the author's system does for two bodies as a sanity check. Three body system was indeed chaotic but still conserve energy - would this system do that? https://en.wikipedia.org/wiki/Lagrangian_mechanics https://en.wikipedia.org/wiki/Lagrangian_mechanics
- zokier 3y agoIt's true that Euler integration is about as crude as you can get, but you don't need to reach to Lagrangians for improvement; something like Verlet integration can already bring dramatic gains with fairly small changes needed.
- _0ffh 3y agoYes, I think it's probably the simplest symplectic method, which would be quite the improvement already.
- forgotpwd16 3y agoCan convert Euler's method to a symplectic integrator utilizing v_{n+1} when computing x_{n+1}. That said although such integrators are widely used (usually of higher order than Euler's) in celestial mechanics, one is not restricted to them. For example Bulirsch-Stoer is also very used even if it isn't symplectic because remains accurate (energy error very low) even on long integrations.
- FredFS456 3y agoI think symplectic integrators are typically used, which are derived from hamiltonian mechanics https://en.wikipedia.org/wiki/Symplectic_integrator https://en.wikipedia.org/wiki/Symplectic_integrator
- zakhar 3y agoHah, I did something similar at https://ari.blumenthal.dev/!/-2/-1/three-body https://ari.blumenthal.dev/!/-2/-1/three-body after reading the book last year. Source at https://github.com/zkhr/blog/blob/main/static/js/three.js https://github.com/zkhr/blog/blob/main/static/js/three.js
- airstrike 3y agoLoved your website. Thanks for sharing.
- yzydserd 3y agoAlso see the source code for the popular ThreeBodyBot [0] as seen on mastodon etc [1] It contains a numerics tutorial [2] that I found very useful for my use case. [0] https://github.com/kirklong/ThreeBodyBot https://github.com/kirklong/ThreeBodyBot [1] https://botsin.space/@ThreeBodyBot/112200106103679713 https://botsin.space/@ThreeBodyBot/112200106103679713 [2] https://github.com/kirklong/ThreeBodyBot/blob/master/NumericsTutorial/NumericalDynamicsTutorial.ipynb https://github.com/kirklong/ThreeBodyBot/blob/master/Numeric... (ipynb)
- PaulHoule 3y agoI noticed that paper they link to was the first one to find new periodic orbits in the three body problem in a long time which confirms what I’ve believed for a long time which is that nonlinear mechanics is badly underresearched.
- sameoldtune 3y agoThere’s a saying in mathematics circles which I’ll butcher here: “everything is either a linear system, reducible to linear systems, or unapproachable.” Think about how bad we are at analytically solving “simple looking” diff-eqs and the above statement starts to sound too true.
- PaulHoule 3y agoExactly. Finding a few hundred periodic orbits is a lot of hard work but you don’t have the glory of having “solved” something. Because of that kind of thinking there are many unanswered questions which are ignored because they don’t seem to be part of some masterstroke.
- nico 3y agoThis is great! Thank you In college, a long time ago, I wrote something like this, for n bodies, but in c++ and OpenGL More recently I’ve built something similar in python For anyone interested in this, I recommend this Wired article that goes from the 2 body problem to n, with simulations and code that run on the browser: https://www.wired.com/2016/06/way-solve-three-body-problem/ https://www.wired.com/2016/06/way-solve-three-body-problem/
- maxglute 3y agoWould be neat if there's planet level visualization in Space Engine like in the show where you see the suns whizzing around and enviroment freeze/burn.
- adamredwoods 3y agoThis isn't planet level, but shows surface: https://universesandbox.com/ https://universesandbox.com/
- adamredwoods 3y agoAlso check out: https://universesandbox.com/ https://universesandbox.com/ https://twitter.com/UniverseSandbox/status/1770922175144300767 https://twitter.com/UniverseSandbox/status/17709221751443007...
- a_gnostic 3y agoNot to forget https://www.kerbalspaceprogram.com https://www.kerbalspaceprogram.com
- zamadatix 3y agoKSP doesn't actually do > 2 body simulations allowing the paths to follow closed form solutions. This is why you have an abrupt orbit change between bodies instead of just a freeform path. There is a mod "Principia" which adds this functionality in but bewarned it makes the game very different to play!
- deleted 3y ago[deleted]
- Georgelemental 3y agoPrincipia is extremely impressive, they document all their math here: https://github.com/mockingbirdnest/Principia/tree/master/documentation https://github.com/mockingbirdnest/Principia/tree/master/doc... One interesting detail is that the source code makes extensive use of non-ASCII identifiers, for mathematical symbols and for the names of mathematicians. One of the two primary contributors is also an active contributor to Unicode
- BlueTemplar 3y agoThanks, I was wondering how feasible this was / how one would do that in C++ !
- wkat4242 3y agoKSP even while simplified is so amazing. I've never gotten very far but the one thing it did manage to impress extremely thoroughly on me is "space is hard". And it's like 5x easier in KSP than on earth lol. Also it showed me that that ever recurring thought of "why don't they just..." is usually pretty misguided. I really respect how they managed to make this fun and so incredibly educational at the same time.
- melondonkey 3y agoLooks like Pokemon Jirachi
- mhkeller 3y agoAdding a svelte three-body animation by rich harris https://svelte-cubed.vercel.app/examples/trisolaris https://svelte-cubed.vercel.app/examples/trisolaris
- QuantumG 3y agoI've used the NAIF SPICE toolkit (https://naif.jpl.nasa.gov/naif/toolkit.html https://naif.jpl.nasa.gov/naif/toolkit.html) which includes the Yarkovsky effect and such, important for small bodies.
- MrCheeze 3y agoIf, like me, you are suddenly curious what would happen if you added a small fourth body: https://youtu.be/WrahPSY9pf0 https://youtu.be/WrahPSY9pf0
- asdfman123 3y agoThis is nothing like what I remember from the book!
- jxy 3y agoProbably try to implement a much better integrator. Some energy preserving higher order integrator should serve a lot better.
- dreamcompiler 3y agoIf you want to take the next step up in accuracy and cleverness, investigate the work of Mr. Runge and Mr. Kutta.
- pizza 3y agoIf you want a good read that (to summarize it quite tersely) takes the idea of 3- or n-body simulations and goes very far indeed with it (i.e. why there is something rather than nothing), I highly recommend checking out Julian Barbour's The Janus Point.
- mafuku 3y agoI've always read about how astronomers, especially after Newton, could predict the movement of the planets with incredible precision, yet n-body problems are so infamously complex and hard to solve, even now. Why is that? Is it simply that the mass of everything except for the sun is just so negligible?
- aoanla 3y agoN-body problems can't be analytically solved. However, you can still compute integrals into the future (with some acceptable error), you just need to step through all the intermediate states along the way In the case of the solar system, yes, it helps that the Sun is much more massive than everything else (and then Jupiter is 4 times more massive than Saturn, the next biggest) - you can go a long way to a "reasonable" solution by starting with the 2-body solution if only the Sun affected each planet, and then adding in the perturbation caused by Jupiter and Saturn. (In fact, that's how we predicted the existence of Neptune, by noticing that there were extra perturbations on Uranus beyond those, and hence another massive planet must exist, far enough away from the sun to only significantly affect Uranus).
- deleted 3y ago[deleted]
- DrFalkyn 3y agoIAMAP, but n-body problems result in non-linear partial differential equations, to which only a few special cases are known, and even that case its do to simplifications, e.g., treating planets as point masses and ignoring tidal forces, or ignoring the pull of the planets on the Sun, (or on each other). One such case where a solution is known is the Lagrange point of the Earth-Moon-Sun system (and similiarly for other points) https://en.wikipedia.org/wiki/Lagrange_point https://en.wikipedia.org/wiki/Lagrange_point But in reality, they exist only as an approximation. They aren't truly stable. My understanding the way to calculate spacecraft, asteroid, etc. trajectories is just through a discrete simulation. Like f you don't know how to solve the antiderivative of a given function, you can still calculate the integral since you know the value of the function.
- 3y ago
- huksley 3y agoI was wondering why it called a three-body problem (at least as it presented in Liu Cixin novel). There is actually at least 4 bodies (3 suns and a planet), right? I suppose the planet will affect the movement of the 3 suns.
- kqr 3y agoNo, it's just three. The reason it's a thing – as far as I understand – is that solving analytically for one body is trivial: it's stationary. Solving analytically for two bodies is possible but takes some calculus. Three bodies have chaotic behaviour and need to be simulated.
- belst 3y agoin the novels there are 3 suns, so it is 4 bodies. The simulation doesn't get easier with 4 tho, so 3 body problem is still a good name. Also the planets mass is "almost" negligible compared to that of the suns, so I assume simulating (+ occasional correcting) 3 bodies is already a good approximation.
- wzdd 3y agoIt’s not a good approximation because (spoilers) the challenge is to identify the location of the planet relative to the suns, not simply to locate the suns themselves. I too wondered at the title.
- forgotpwd16 3y agoProbably a misnomer. And issue isn't really about the planet affecting the movement of the 3 suns (its mass can be considered deligible compared to them) but how the suns affect the movement of the planet. Essentially they're looking for a solution to the restricted 4bp rather the 3bp.
- deleted 3y ago[deleted]
- micheljansen 3y agoI've been re-reading the trilogy lately and it also lead me to search for some three-body simulations. I noticed that a lot of them are simulating only a 2D space. Any good (animated) 3D simulations? Best I've been able to find so far are https://demonstrations.wolfram.com/ThreeBodyProblemIn3D/ https://demonstrations.wolfram.com/ThreeBodyProblemIn3D/ and https://labs.sense-studios.com/threebody/index.html https://labs.sense-studios.com/threebody/index.html
- yieldcrv 3y agoisn’t that story a 4-body problem?
- micheljansen 3y agoNot a physicist, but apparently the planet does not really have enough mass to matter: https://www.reddit.com/r/threebodyproblem/comments/15cgd51/isnt_it_actually_a_four_body_problem/ https://www.reddit.com/r/threebodyproblem/comments/15cgd51/i...
- badrunaway 3y agoWhat does three body problem tell us about our universe? It surprises me that universe by its nature ended up with such smart safeguards to disallow predictability via computation.
- zelphirkalt 3y agoIs there some way of determining, whether the orbits, given some starting parameters, _at some point_ will become stable? I probably mean periodic. And I probably mean mostly periodic, with only slight deviation from orbits. And I don't necessarily mean that we can calculate/predict what they will look like in a stable form. This reminds me of Langtons Ant, that has very simple rules, but at first still seems very chaotic. Then after some number of iterations it just shoots away in a regular endlessly regular repeating pattern. "Order came from chaos." So it makes me think, maybe there is not a way to tell, whether the orbits "stabilize" at some point, but maybe they will, and we simply don't know when or how to tell?
- alex_duf 3y agoCompletely selfish plug, but it's not very hard to implement, so here's my implementation using p5js: https://editor.p5js.org/alexduf/full/c-iSj_b4p https://editor.p5js.org/alexduf/full/c-iSj_b4p you can play around with the code. Clicking generate a new solar system. There are a few constants you can adjust at the top of the file.