# Finite differencing scheme for Hamilton's equation with planar linkages

I am trying to simulate the movement of a planar linkage in the plane whose position and momentum obey Hamilton's equations, which is to say that $${{dq}\over{dt}} = {{dH}\over{dp}}$$ and $${{dp}\over{dt}}=-{{dH}\over{dq}}~,$$where $q(t)$ is the function that specifies the position of the linkage elements, $p(t)$ represents the momenta of the linkage elements, and $H(q,p)$ is the energy function. Numerically speaking, what would be the most appropriate finite-differencing scheme to use? At the moment I am using a simple basic difference scheme given by $$q(t+\Delta t) = q(t) + \Delta t \left({{dH}\over{dp}}(q(t),p(t))\right)$$and $$p(t+\Delta t) = p(t) + \Delta t \left({-{dH}\over{dq}}(q(t),p(t))\right)$$ where the derivative $dH/dq$ is an algebraic function that I have a closed formula for. Are there other differencing schemes that would be better suited for this, like (say) forward vs. backward Euler?

• You want to atleast do a Runge-Kutta. But for Hamiltonian systems, the most appropriate scheme is to use variational integrators. – Piyush Grover Jul 25 '14 at 21:57
• Thanks @PiyushGrover -- do you know any good starting references for these? I have not worked with "variational integrators" before – Charles Baker Jul 25 '14 at 22:44