4 ms·
Can someone explain the math behind this? Which methods were used? I wasn't aware it was possible to run such a simulation on flash because each body results in
by mathu7 12y ago
Can someone explain the math behind this? Which methods were used? I wasn't aware it was possible to run such a simulation on flash because each body results in 6x more calculation. Is this like plugging in the masses into a single equation? I want to learn more about how this is done .
- nanofortnight 12y agoThe simplest numerical approximation method is Euler's method. It also tends to be unstable. Personally I prefer to just throw a fourth order Runge–Kutta (RK4) at things and normally that's more than good enough. List of reading: http://gafferongames.com/game-physics/integration-basics/ http://gafferongames.com/game-physics/integration-basics/ http://en.wikipedia.org/wiki/Euler_method http://en.wikipedia.org/wiki/Euler_method http://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_methods http://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_met... http://mathworld.wolfram.com/Runge-KuttaMethod.html http://mathworld.wolfram.com/Runge-KuttaMethod.html http://en.wikipedia.org/wiki/Linear_multistep_method http://en.wikipedia.org/wiki/Linear_multistep_method http://en.wikipedia.org/wiki/Bulirsch%E2%80%93Stoer_algorithm http://en.wikipedia.org/wiki/Bulirsch%E2%80%93Stoer_algorith...
- exDM69 12y ago> Personally I prefer to just throw a fourth order Runge–Kutta (RK4) at things and normally that's more than good enough. In the context of gravity simulation, I must point out that while Runge-Kutta/RK4 is good enough for a lot of stuff but it has a tendency to dissipate energy. It's not very good in a simulation where the conservation of energy is important. Run a simulation long enough and the orbits will eventually shrink. If scientific accuracy is required, gravity simulations are usually done with "symplectic" integrators (which don't "lose" energy) and the equations of motion are written using Hamiltonian mechanics. There are symplectic variants of Runge-Kutta too. In an exercise work for a celestial mechanics course, I wrote an n-body simulator using a dissipative Runge-Kutta method (because it was good enough for that, and the exercise was about using RK methods). Simulating an exoplanet system (HR 8799), the orbits were stable and 100 year simulation gave near perfect orbits. After 1000 years, there orbits were a bit smaller and after 10000 years, they had lost a fourth of the initial energy. This was done using one day timesteps. http://en.wikipedia.org/wiki/HR_8799 http://en.wikipedia.org/wiki/HR_8799
- lutusp 12y ago> Can someone explain the math behind this? Which methods were used? I can't speak to the linked simulator, but gravitational calculations are relatively simple -- they represent the solution to a numerical differential equation that, in small slices of time, solves: f = G m1 m2 / r^2 Where: f = force, Newtons G = Universal gravitational constant: http://en.wikipedia.org/wiki/Gravitational_constant http://en.wikipedia.org/wiki/Gravitational_constant m1 = mass of body 1, kilograms m2 = mass of body 2, kilograms r = distance between m1 and m2, meters Here's my simulator, plus (further down the page) a complete description of the math. My simulator uses HTML5 and JavaScript: http://arachnoid.com/orbital_dynamics http://arachnoid.com/orbital_dynamics > I wasn't aware it was possible to run such a simulation on flash because each body results in 6x more calculation. It's more accurate to say that the total computing time required changes as the square of the number of modeled bodies. That's worse than 6x, by the way, for a sufficient number of bodies. One solution is to use a large central mass and only compute the paths of some satellites with respect to the central mass, not with respect to each other. The calculations that impress me (and I do a lot of this kind of math) are the cosmological modeling of galactic clusters of hundreds of thousands of stars, all interacting with each other, with no central mass to stabilize things. This requires a supercomputer and many hours of online time. > Is this like plugging in the masses into a single equation? No, because for more than two bodies, there's no closed-form solution (this is called the "three-body problem"). Solutions must be arrived at numerically. When NASA wants to compute where to land a spacecraft on Mars, they have to use numerical methods -- very good ones, but numerical methods. http://en.wikipedia.org/wiki/Three-body_problem http://en.wikipedia.org/wiki/Three-body_problem
- mturmon 12y agoHere are the people who do this for NASA planetary missions: http://ssd.jpl.nasa.gov http://ssd.jpl.nasa.gov Here's a snapshot of object locations in the inner solar system: http://ssd.jpl.nasa.gov/?ss_inner http://ssd.jpl.nasa.gov/?ss_inner There are a lot of challenging problem areas: rendezvous with small bodies (very irregular gravity fields), mission trajectory design, operations planning for flybys in the presence of, say, camera pointing constraints. (@lutusp knows this already -- I'm putting it here just for interest.)