Live data from Hacker News

Gravity Simulator

nowykurier.com

121–130 of 135 posts

Re: Gravity Simulator

#122

This is nice, but please rename the OMFG button. As someone who works in K-12, it would be a shame if a program like this is rejected because of a button.

agreed. This is really cool (and simple too) Also, how hard would it be to set an initial state of our current solar system? Teachers could set up scenarios for students to interact with, and allow students to collaborate. Maybe as simple as an output/input of textual data for saving & restoring state? i'd love to try model our current solar system, and see if i can get something to mars with just an initial trajecto…

The scale of the Solar System would require you to visualize the bodies as much larger than their true size in order to see everything on one screen. If the Sun is 1 pixel, all other bodies are way smaller than a pixel, and Neptune is 3000 pixels away. And of course, you'd probably want to speed up the simulation speed.

Re: Gravity Simulator

#124
Does anyone know why perihelion moves in this simulation? I learned that perihelion movement can only be explained by general relativity, not newtonian mechanics. Is this just a limit of computer simulation? (which can't calculate the exact value of Gm1m2/r^2)

Re: Gravity Simulator

#125
post #69

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.

Here's my HTML5 Version: https://news.ycombinator.com/item?id=8288434

Great job! Took a while to figure out for panning I just have to move and not click. Looking at the source always helps ;)

Re: Gravity Simulator

#127

Does anyone know why perihelion moves in this simulation? I learned that perihelion movement can only be explained by general relativity, not newtonian mechanics. Is this just a limit of computer simulation? (which can't calculate the exact value of Gm1m2/r^2)

It is a shortcoming of the integrator (Euler), not in the calculation of the force (as you suspected).

See [1]. Especially slides 11 and 12 may be of interest.

[1] http://www.astro.sunysb.edu/phy277/lect30.pdf

As a sidenote, there are better integration schemes, but all of them will have some error because we discretize the system.

Re: Gravity Simulator

#129

I have a question about a phenomenon I am seeing. say you add 3+ equal mass objects without a velocity and they all collide with each other without "missing or orbiting" one another. Sometimes the final mass will have a velocity. It would seem like it should not have a velocity because it would be canceled out. What am I missing? Where is this energy coming from?

In real life, the three colliding bodies would convert their kinetic energy into heat and combine into a very hot body. Sort of how we think the moon was created, from a Mars-sized body colliding with Earth long ago.

But in a numerical simulation, usually what happens is that three bodies on a collision source approach one another but, because of the limitations of numerical differential equation solving, suddenly fly away from each other in a rather non-physical way, and with more energy than they had to begin with.

The tl;dr: most of the funny effects in a simulator arise from the limitations of numerical simulation methods, and many of those aren't representative of real physics.

Post reply on HN