4 ms·
Very nice, wish it was HTML5 rather then flash.. It brings to light how hard it is to get a stable solar system. And of course I knew this but playing around I
by kator 12y ago
Very nice, wish it was HTML5 rather then flash.. It brings to light how hard it is to get a stable solar system. And of course I knew this but playing around I realized our sun is not stationary either... It's easy to forget the entire solar system we live in is this amazing mix of interactions between the planets, sun, other debris and outside mass from other parts of the universe.
- karol 12y agoThe source is browsable if you modofy the URL. I expect someone with create a canvas driven clone within 48h:)
- mcdevhammer 12y agoDone. Although I did this years ago: http://mobile.sheridanc.on.ca/~claassen/Gravity/Gravity.html http://mobile.sheridanc.on.ca/~claassen/Gravity/Gravity.html
- dj-wonk 12y agoGreat! I tried it out; when I combined a galaxy with a field , many particles went flying from the center at a high rate of speed. Why is that?
- mcdevhammer 12y agoWhen a small particle gets accelerated to great speeds as it approaches a massive object it simply passes through because the collisions are off/aren't perfect even when they're on
- dj-wonk 12y agoIt would be nice to arbitrarily choose a specific particle to be the center of the system (the frame of reference).
- mathu7 12y agoCan 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
- lemmingapex 12y agoHere's my HTML5 Version: https://news.ycombinator.com/item?id=8288434 https://news.ycombinator.com/item?id=8288434
- programmarchy 12y agoRight-clicking is a nice treat! Interesting to compare the different integration methods, too. Excellent work.
- ardoi 12y agoGreat job! Took a while to figure out for panning I just have to move and not click. Looking at the source always helps ;)