In a system where energy theoretically should be conserved, the most accurate simulation would conserve energy (as well as giving accurate positions, velocities and etc). RK4 is more accurate than leapfrog, yet leapfrog conserves energy and RK4 doesn’t. Why is this?


1 Answer 1


TL;DR: It depends on what kind of accuracy you need.

Energy conservation does not automatically equal accuracy. Suppose, you want to simulate the solar system, and you are using a solver that – to use an extreme example – just rotates the entire system by some angle every second. These solutions obviously conserve energy, but they are blatantly incorrect.

On the other hand, if you want to predict celestial motions for a sufficiently short time span, then the effects of a Runge–Kutta method not preserving energy are negligible. Rather, this takes its toll on long-term simulations. On short time scales, a Runge–Kutta method will give you more accurate results than leapfrog – at least for a comparable computational effort.

Now, on long time scales, neither method yields very accurate results in the sense of predicting the precise future of some initial condition (which may also get difficult due to the butterfly effect). However, the leapfrog method at least yields some plausible solution, as energy is preserved. This is sufficient for many simulations where the qualitative behaviour of the investigated systems is of interest.

  • $\begingroup$ This went beyond what I asked to exactly what I needed to know, in particular the strengths of each on differing timescales. Also, that example aided my understanding greatly. Thank you very much. $\endgroup$ Oct 16, 2016 at 10:48
  • $\begingroup$ Note that symplectic methods conserve an energy that is CLOSE to the correct value, but slightly in error, according to their order. $\endgroup$ Oct 19, 2016 at 19:15

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.