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?
$\begingroup$
$\endgroup$
2
-
$\begingroup$ You want to atleast do a Runge-Kutta. But for Hamiltonian systems, the most appropriate scheme is to use variational integrators. $\endgroup$– Piyush GroverCommented Jul 25, 2014 at 21:57
-
$\begingroup$ Thanks @PiyushGrover -- do you know any good starting references for these? I have not worked with "variational integrators" before $\endgroup$– Charles BakerCommented Jul 25, 2014 at 22:44
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
What you are doing above looks like forward Euler to me, which is very bad for Hamiltonian systems since it tends to continually add energy. (Backward Euler tends to continually remove energy.) The simplest sound method is the Verlet integrator, which is 2nd order and symplectic. You can read about it in
http://books.google.ca/books/about/Simulating_Hamiltonian_Dynamics.html?id=tpb-tnsZi5YC
or
http://books.google.ca/books/about/Geometric_Numerical_Integration.html?id=O5CfNSGTP_EC&redir_esc=y
among other methods.