2
$\begingroup$

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?

$\endgroup$
2
  • $\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$ Commented Dec 30, 2015 at 12:53
  • $\begingroup$ @MartinUeding Newtonian mechanics only, planets do interact but are only modelled as point masses. $\endgroup$
    – user13948
    Commented Dec 30, 2015 at 15:06

1 Answer 1

6
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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