I've written a java program to model the solar system, and I need to test its accuracy. What would be some good ways to do that? I've checked for conservation of energy and angular momentum. I'm using the velocity verlet algorithm, which seems to have perfectly conserved both of those.

I wondered if there was a way to check if they're back where they started after one orbital period, but couldn't work out how to program a check. I'd really like a way to measure the effect of changing the timestep, but I don't know what a good measure would be? Is there anything else I could do?

  • $\begingroup$ To what detail of the interactions does your program go? Does it take interaction of the planets into account? Does it use GR or Newtonian mechanics? You could try to check whether Kepler's laws are fulfilled. $\endgroup$ – Martin Ueding Dec 30 '15 at 12:53
  • $\begingroup$ @MartinUeding Newtonian mechanics only, planets do interact but are only modelled as point masses. $\endgroup$ – user13948 Dec 30 '15 at 15:06

A simple and generic way to test such programs is evolving backwards in time: Choose some initial conditions, evolve for a time $T$, then invert all velocities, evolve again for a time $T$, and check how close you are to the initial conditions.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.