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.
Gravity Simulator
81–90 of 135 posts
Re: Gravity Simulator
#82Quote: "Particle mass is log of radius". Why not use real physics and make the mass proportional to the cube of the radius? It's also easier to compute. In fact, taking the log of the radius goes in the wrong direction -- the mass of a planet really does increase as the cube of its radius, which changes in a way opposite to log(). Oh, well. Here's my gravity simulator -- it uses JavaScript, no flash required: http://…
> "Particle mass is log of radius" They seem to have corrected the sentence now: "particle radius is log of mass". Wow, your simulator is much nicer, plus a great article about it to boot! You should add an option to play cosmic billiard, that's probably the main appeal of the flash simulator :)
> They seem to have corrected the sentence now: "particle radius is log of mass".
It's still wrong. Here's a graph comparing mass = e^radius (the reciprocal of radius = log(mass) ) versus mass = radius^3:
http://i.imgur.com/XkVFgIH.png
My point is that the two functions have a different behavior, the absolute values generated aren't very important compared to that. For solutions to f = G m1 m2 / r^2 where both bodies are computed, this will produce results wildly different than reality. (If only one body is computed, for example against a much larger parent body mass, the satellite mass stops making a difference.)
> You should add an option to play cosmic billiard, that's probably the main appeal of the flash simulator :)
Nice idea. I was more interested in portraying the solar system using real planetary masses and real physical constants. Still, it's a nice suggestion.
Re: Gravity Simulator
#83Very 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.
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 .
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://en.wikipedia.org/wiki/Euler_method
http://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_met...
http://mathworld.wolfram.com/Runge-KuttaMethod.html
http://en.wikipedia.org/wiki/Linear_multistep_method
http://en.wikipedia.org/wiki/Bulirsch%E2%80%93Stoer_algorith...
Re: Gravity Simulator
#84Re: Gravity Simulator
#85Re: Gravity Simulator
#86Very 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.
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 .
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
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
> 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.
Re: Gravity Simulator
#87Re: Gravity Simulator
#88Very cool! I was able to get 2 masses to oscillate around each other in a funny way[1]. Seems they keep going like that forever. What is this kind of equilibrium called? [1] http://imgur.com/FQYpo9V
Isn't that a normal orbit around a common centre of mass? As the objects have a similar size the centre of mass appears to wobble as it moves along. In the frame of the centre of mass, the objects would just go round in standard orbits.
If you limit yourself to looking at the position of one body with respect to another, the orbit will be an ellipse. A circular orbit is simply a special-case ellipse with an eccentricity of zero. This is true for any two orbiting masses -- from the perspective of either of them, the other body's orbit will be an ellipse. And yes, it's always with respect to the common center of mass.
Interestingly, mostly because of Jupiter, the solar system's common center of mass can sometimes lie outside the sun.
Re: Gravity Simulator
#89Very cool! I was able to get 2 masses to oscillate around each other in a funny way[1]. Seems they keep going like that forever. What is this kind of equilibrium called? [1] http://imgur.com/FQYpo9V
Once you change references frames to the center of mass, two bodies that are gravitationally bound are always following ellipses. It looks like this in the case where they have equal mass: https://en.wikipedia.org/wiki/Barycentric_coordinates_(astro... Likewise, two bodies that are not bound will follow hyperbolas in the center of mass frame.
Or parabolas, which also represent unbound solutions. In an orbital system, a parabolic trajectory represents escape velocity (exactly), a solution in which the escaping body's velocity is in progressive decline, and that reaches zero at infinity.
Re: Gravity Simulator
#90Earlier quoted context omitted.
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 .
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://en.wikipedia.org/wiki/Euler_method http://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_met... http://mathworld.wolfram.c…
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.