3 ms·
The 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)
by nanofortnight 12y ago
The 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