# How to tell if symplectic integrator is more suitable for my problem, and what are downsides?

My intention was to use a classical Runge-Kutta 45 method to solve ODEs of my system. However, I have seen recommendations for using symplectic integrators, because they do a better job at conserving the total energy of the system. Again, my system is : $$\ddot x = - \frac A{||x||^3} * x$$
• This question isn't really on-topic here; it's more of a programming question, and I encourage you instead to write your code, compile it, debug it, and run it. Anyway, to answer your question: yes, you can calculate intermediate expressions in the right-hand side function (here, my_system). You probably want to declare A, mag_x, and mag_x_cub inside the function rather than outside to limit their scope. I also got the impression from your original question that $A$ was supposed to be a matrix instead of a scalar. – Geoff Oxberry Nov 19 '14 at 3:54