## Context

A canonical Hamiltonian system is a dynamical system for which the dynamics is given by Hamilton’s equations

for some function

called the Hamiltonian. It is clear that Eqs. (1) correspond to an ordinary differential system and thus it can be solved 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 (

). 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

as is frequently encountered with dynamical systems. Typically,

corresponds to the kinetic energy and

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:

## Reference and program

- Symplectic integrator:
- Matlab program: Matlab file exchange server: Symplectic Leap Frog Scheme
- Main program: sympleapfrog.m
- Example, application of the program to the simple and forced pendulum: Pendulum.m
- Copyright (c) 2012, F. Mauger - Centre de Physique Theorique (CPT), CNRS/Aix-Marseille University - License BSD

## Updates

- December 17, 2013
- Allow installable output function (with output selection indices)
- Allow events detection