I can't help but notice there is a magical "Theta" parameter, with the description "Higher = faster, less accurate". I think here it's a threshold for ignoring children nodes' internal structure in an octree. As a matter of good software engineering (and numerical analysis, and mathematics, too), your software shouldn't have magical parameters with mysterious consequences for the correctness of your software. (I know…
It was really meant just as a toy and not a scientifically rigorous simulation. Any value of theta is going to make not 100% accurate (not to mention the simulation speed which also affects accuracy).
HTML5 Gravity/Galaxy Simulator
11–20 of 21 posts
Re: HTML5 Gravity/Galaxy Simulator
#12Earlier quoted context omitted.
Yeah maybe it would be nice idea if when you generate a galaxy it also generates small dark matter particles around the regular particles.
First a simulator like this would have to be written with Einstein's equations. This is (just a guess) a newtonian physics sim.
Re: HTML5 Gravity/Galaxy Simulator
#13Earlier quoted context omitted.
> As a matter of good software engineering (and numerical analysis, and mathematics, too), your software shouldn't have magical parameters with mysterious consequences for the correctness of your software. To some extent, yes, but consider that we're speaking of a numerical differential equation solver. If we make the time steps too large, the program runs fast but the simulation is less realistic. If we go too far a…
> To some extent, yes, but consider that we're speaking of a numerical differential equation solver. If we make the time steps too large, the program runs fast but the simulation is less realistic. If we go too far and make the time steps very small, we'll start seeing rounding errors in the floating-point processing. But this just means that the problem needs to be solved carefully; what you've done is state the pro…
It is a difficult problem. Consider all the elements of a solution on which space missions depend. All of them must be generated using numerical modeling methods, and for a solar system simulation in which most or all the candidate bodies are modeled, the computation load is quite high.
> but you can still mathematically pick a parameter that generates something like a desired level of accuracy, instead of having to specify the parameter itself.
This isn't true, or it's not assured to be true. The reason is that orbital systems with > 2 bodies meet the definition of a chaotic system, a system acutely sensitive to initial conditions. Everyone who works in this field understands that there's a time horizon past which we really cannot say what the solar system's configuration will be.
Re: HTML5 Gravity/Galaxy Simulator
#14Earlier quoted context omitted.
> To some extent, yes, but consider that we're speaking of a numerical differential equation solver. If we make the time steps too large, the program runs fast but the simulation is less realistic. If we go too far and make the time steps very small, we'll start seeing rounding errors in the floating-point processing. But this just means that the problem needs to be solved carefully; what you've done is state the pro…
> You make all of this sound like it's a difficult problem. It is a difficult problem. Consider all the elements of a solution on which space missions depend. All of them must be generated using numerical modeling methods, and for a solar system simulation in which most or all the candidate bodies are modeled, the computation load is quite high. > but you can still mathematically pick a parameter that generates somet…
Implementing an ODE solver good enough to use for designing spacecraft trajectories is a difficult problem. Implementing an ODE solver that can handle an n-body problem (with a fairly small n) without leaving user-visible magical parameters is not difficult. Introductory textbooks can explain how to do this.
> The reason is that orbital systems with > 2 bodies meet the definition of a chaotic system, a system acutely sensitive to initial conditions.
Even if you have a chaotic dynamical system, you can still solve it. You don't solve it in the sense that the trajectory you get is the correct one, because, as you rightly say, that is mathematically impossible for long time periods. But you can solve it in the sense that the solution you get "could" have originated from an initial condition close to the given initial condition.
There are many interesting things you can do for complicated ODE problems. But writing ODE solvers of the level of complexity and accuracy we are talking about here is a solved problem.
Re: HTML5 Gravity/Galaxy Simulator
#15This is cool, and I'm a sucker for gravity/space simulators (as my hours logged on Celestia would prove), but it should be noted that in terms of "galaxy" it's inaccurate. Specifically, this inaccuracy (the galaxy rotation problem) is the driving force behind the hypothesis of dark matter [0]. I don't mean to be pedantic or anything. I just think it's interesting. [0] http://abyss.uoregon.edu/~js/cosmo/lectures/lec17…
Yeah maybe it would be nice idea if when you generate a galaxy it also generates small dark matter particles around the regular particles.
Re: HTML5 Gravity/Galaxy Simulator
#16This is cool, and I'm a sucker for gravity/space simulators (as my hours logged on Celestia would prove), but it should be noted that in terms of "galaxy" it's inaccurate. Specifically, this inaccuracy (the galaxy rotation problem) is the driving force behind the hypothesis of dark matter [0]. I don't mean to be pedantic or anything. I just think it's interesting. [0] http://abyss.uoregon.edu/~js/cosmo/lectures/lec17…
Re: HTML5 Gravity/Galaxy Simulator
#17I can't help but notice there is a magical "Theta" parameter, with the description "Higher = faster, less accurate". I think here it's a threshold for ignoring children nodes' internal structure in an octree. As a matter of good software engineering (and numerical analysis, and mathematics, too), your software shouldn't have magical parameters with mysterious consequences for the correctness of your software. (I know…
Read: http://en.wikipedia.org/wiki/Barnes–Hut_simulation , look for the theta symbol.
The only thing you can really knock this implementation is not explaining the definition of theta, but you can't much do that without a writeup of how the Barnes-Hut simulation works. I think "higher = faster, less accurate" is just fine for a demo's purpose.
Re: HTML5 Gravity/Galaxy Simulator
#18This is cool, and I'm a sucker for gravity/space simulators (as my hours logged on Celestia would prove), but it should be noted that in terms of "galaxy" it's inaccurate. Specifically, this inaccuracy (the galaxy rotation problem) is the driving force behind the hypothesis of dark matter [0]. I don't mean to be pedantic or anything. I just think it's interesting. [0] http://abyss.uoregon.edu/~js/cosmo/lectures/lec17…