A canonical Hamiltonian system is a dynamical system for which the dynamics is given by Hamilton’s equations
d_t q = ∂_p H, (1a)
d_t p = -∂_q H, (1b)
for some function H(q,p) called the Hamiltonian. It is clear that Eqs. (1) correspond to an ordinary differential system and thus it can be solves numerically, with an arbitrary precision, using standard schemes such as Euler or Runge-Kutta methods.
Hamiltonian systems are generally built up from first principles like energy conservation. Indeed, using Hamilton’s equations (1), one can show easily that the Hamiltonian is a conserved quantity (d_t H = 0). More than the conservation of the Hamiltonian, (canonical) Hamiltonian systems are equipped with a symplectic structure which is preserved by the dynamics. The conservation of the Hamiltonian is only a consequence of this symplectic structure.
On the other hand, the discrete map offered by numerical schemes generally does not preserve the symplectic structure (standard Euler or Runge-Kutta methods for instance). This can be seen by looking at the evolution of the Hamiltonian with time, which typically presents a drift, characteristic of the breaking of the symplectic structure. To overcome this difficulty, a class of numerical schemes, called symplectic integrators, has been designed to preserve the symplectic structure for the discrete map corresponding to the numerical integration.
Here we propose a symplectic scheme for a class of canonical systems where the Hamiltonian is separable, that is
H(q,p) = T(p) + V(q),
as is frequently encountered with dynamical systems. Typically T(p) corresponds to the kinetic energy and V(q) to the potential.
If the system is not autonomous, the symplectic scheme can be used if the explicit time dependence is contained in the potential term only:
H(q,p,t) = T(p) + V(t,q).
Mauger François (2021). Symplectic Leap Frog Scheme (https://www.mathworks.com/matlabcentral/fileexchange/38652-symplectic-leap-frog-scheme), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!