TITLE: "Constrained" numerical solutions of ODEs with conservation laws?
QUESTION [7 upvotes]: I know little about numerical methods and I was considering the following problem that possibly has standard solution in the literature.
Suppose you have an ODE for wich we already know that it must satisfy a conservation law for some "energy" (for example hamiltonian dynamical systems such as $\frac 1 2 m \dot{x}^2+U(x)=\mbox{const}$). Then if we try to solve it with standard Runge Kutta methods we are likely to have errors for the energy at each step, which possibly will sum up. But what if I want to sacrifice a little accuracy for the "position" in order to have a greater accuracy for the energy? (This could be relevant if for example I am interested in having good approximation of long time asimptotic behaviors which should not be affected by errors in short time dynamics). Are there numerical methods which tries to give the best approximation given the constrain of keeping the energy "strictly" fixed?

REPLY [3 votes]: While energy conservation is important, specifically in Hamiltonian systems, it is not enough.
Rather, it is important to preserve the symplectic structure, which means that your initial conditions should be mapped forward in time using only canonical transformations. That is where the symplectic integrators come in, as mentioned by ccorn.