3 ms·
I always enjoy playing with these kinds of simulations, but this one seems to be pretty bad at respecting conservation of energy. The closer you are to the sun,
by teraflop 12y ago
I always enjoy playing with these kinds of simulations, but this one seems to be pretty bad at respecting conservation of energy. The closer you are to the sun, the more rapidly your spacecraft mysteriously gains energy from nowhere, causing it to spiral outward instead of maintaining a stable orbit. I'm not sure yet whether it's a consequence of using naive Euler integration or some other bug.
- notthemessiah 12y agoBecause of the nature of FRP, you can't do much except for Euler integration.
- abecedarius 12y agoHow about http://en.wikipedia.org/wiki/Symplectic_Euler_method http://en.wikipedia.org/wiki/Symplectic_Euler_method ? That's what I used in http://wry.me/t/gravity/gravity.html http://wry.me/t/gravity/gravity.html (Which is not in Elm; it simulates a solar sail instead of a rocket.)
- vertex-four 12y agoWhy not, precisely?
- shanemhansen 12y agoI too wasted lots of time playing with these simulations. The feyman lecture on physics have a great chapter on this stuff. The orbit does tend to pick up energy due to errors coming from euler's method. A relatively simple way to make your orbits a bit more stable is to normalize your velocity vectors using conservation of energy.
- fenollp 12y agoI'd say the newly gained acceleration is due to [1] the force of attraction suddenly disappearing. [1] https://github.com/stephenbalaban/Gravity/blob/master/Gravity.elm#L93 https://github.com/stephenbalaban/Gravity/blob/master/Gravit...