In dedication of accuracy
Explicit symplectic integration
Introduction
A Hamiltonian describes a system through a single function that is often its total energy.
For a separable system, the Hamiltonian H is written as the sum of kinetic energy T, which depends on momentum p, and potential energy V, which depends on position q.
In plain language: the system’s state is split into a momentum part and a position part.
Hamilton’s equations connect those two coordinates. Momentum changes in response to the slope of the energy with respect to position; position changes in response to its slope with respect to momentum.
A splitting method advances the state through a sequence of small substeps. At stage i, it first updates position and then momentum:
Here, τ is the time step; ci and di are splitting coefficients; and the number of coefficient pairs determines the number of stages. Their values determine the splitting method’s order and accuracy.
Unlike a general-purpose Runge-Kutta methods, a symplectic integrator preserves the geometry of phase space. The energy is generally not perfectly constant at every step; instead, the energy error tends to remain bounded and oscillatory over long integrations. This behavior is especially valuable in celestial mechanics, accelerator physics, molecular dynamics, and quantum chemistry.
Open original interface image ↗
Extended applications
The cleanest case is autonomous and separable, but related techniques can also treat systems whose kinetic or potential energy changes explicitly with time:
These are non-autonomous systems, so the Hamiltonian need not be conserved. More advanced formulations extend the same splitting to non-separable systems, where position and momentum cannot be isolated into independent terms:
With care, the same computational patterns can also be useful for differential equations that are not governed by a Hamiltonian, although some symplectic guarantees may no longer apply.
The Zymplectic project
Zymplectic differs from broad differential-equation libraries such as GSL or JuliaDiffEq: it is intentionally focused on Hamiltonian systems and explicit symplectic integrators.
The application loads C/C++ source files containing Hamilton’s equations, compiles them, and runs the resulting model with the chosen method, visualisation, and numerical settings. It can present simulated objects, trajectories, energy surfaces, and error data without requiring users to learn a large application interface.
The downloadable package includes either MinGW GCC or Clang, so it can work without a separate IDE or compiler installation. The included MinGW are replacable with other and possibly newer builds of GCC or Clang.
Zymplectic's catalogue of numerical methods ranges from simple symplectic Euler and leapfrog methods to high-order symplectic partitioned Runge–Kutta and Runge–Kutta–Nyström schemes, but includes also customized construction of higher order methods by Yoshida's composition method as well as formally unpublished techniques.
Dynamical systems
The 100 dynamical systems included in the 0.16.1 release, not including advanced and constrained systems.
- 00henon-heiles
- 01simple pendulum
- 02pendulum on cart with spring
- 03two-pendulum cart
- 04two-body central-force
- 05two-body polar coordinates
- 06two-body on cylinder
- 07solar system
- 08N-body system jacobi
- 09three body stable
- 10rolling disk
- 11atwood machine
- 12swinging atwood
- 13horizontal atwood (variant 1)
- 14horizontal atwood (variant 2)
- 15double pendulum (variant 1)
- 16double pendulum (variant 2)
- 17double pendulum (variant 3)
- 18100 double pendulums
- 19100 double pendulums in spring
- 20double pendulum in spring
- 21double pendulum on cart with spring
- 22double pendulum variable length
- 23double pendulum flail
- 24double pendulum slider crank
- 25double pendulum interacting spheres
- 26driven double pendulum
- 27rotating double pendulum
- 28double spherical pendulum
- 29triple pendulum zero gravity
- 30N-pendulum
- 31N-pendulum nonautonomous
- 32N-spherical pendulum
- 33semicircle rocking pendulum
- 34crank-rocker extended
- 35gyro single spoke
- 36gyro single spoke SPC
- 37gyro wheel
- 38kapitza pendulum
- 39spherical pendulum
- 40spherical pendulum platform
- 41spherical pendulum SPC
- 42facault pendulum
- 43spring pendulum
- 44spring N-pendulum
- 45spring hanging chain
- 46spring coupled pendulums
- 47pendulum with spring
- 48pendulum with spring SPC
- 49pendulums hanging from springs
- 50double-compound pendulum
- 51pendulum wheel (variant 1)
- 52pendulum wheel (variant 2)
- 53bead pendulum
- 54bead on rotating wire
- 55beads on a rotating hoop
- 56bead in a swinging hoop with spring
- 57bead on suspended rope 2D
- 58bead on suspended rope 3D
- 59quadrupole mass spectrometer
- 60soft boundary billiards
- 61gyroscope frame
- 62black hole kerr metric (variant 1)
- 63black hole kerr metric (variant 2)
- 64black hole kerr de sitter
- 65vortex motion
- 66wave
- 67wave grid
- 68schrodinger equation 1D
- 69schrodinger equation 2D
- 70schrodinger eigenstates 1D
- 71wave pendulum
- 72maxwell-boltzmann distribution
- 73maxwells equations 2D
- 74magnetic dipole stoermer problem
- 75kinetic mobile
- 76cycloidal pendulum
- 77brachistochrone
- 78wilberforce pendulum
- 79sphere on radial surface
- 80sliding box
- 81rail pendulum
- 82rail spring
- 83spherical atwood (variant 1)
- 84spherical atwood (variant 2)
- 85quaternion rigid bodies
- 86quaternion rigid body on spring
- 87quaternion L-rod
- 88quaternion reaction wheels
- 89gravitational wedge billiard
- 90elastic boundary (variant 1)
- 91elastic boundary (variant 2)
- 92tesseract
- 93rolling on curve
- 94rolling on flat plane
- 95galilean cannon
- 96oscillating spring platform
- 97three body fixed perimeter
- 98rolling sphere
- 99rolling ellipsoid
Showcases
- 01 The two-body problem
- 02 Trajectories of Hamiltonian systems
- 03 Integrator: autonomous and separable
- 04 The quadrupole mass spectrometer
- 05 The Kapitza pendulum
- 06 The double pendulum
- 07 Benchmark: fifth-order integrators
- 08 Soft-boundary billiards
- 09 Spherical pendulum: Euler angles
- 10 Spherical pendulum: stereographic projection
Showcase list last updated 2023.03.27
Ease of use
A model needs Hamilton’s equations, initial conditions, and a short initialisation function. Macro-augmented C++ keeps comprehensive systems compact while retaining native performance.
#include "math.h"
const double lambda = 1.0;
double _q_init[] = {0.3, 0.0}; // position
double _p_init[] = {0.0, 0.4}; // momentum
double energy_H(Arg) {
return lambda*q2*(q1@2 - q2@2/3.0)
+ 0.5*(q1@2 + q2@2 + p1@2 + p2@2);
}
void dH(Arg) {
dq1 = q1 + lambda*2*q1*q2;
dq2 = q2 + lambda*(q1@2 - q2@2);
dp1 = p1;
dp2 = p2;
}
void main() {
Z.H(energy_H, dH, 0);
}
Objects can be paired with one another or assigned to separate kinetic and potential energies, making larger physical systems possible with relatively little model code. Or multiple objects can be applied to the same system:
...
double _q_init[] = {0.3, 0.0, 0.2, 0.0, 0.1, 0.0};
double _p_init[] = {0.0, 0.4, 0.0, 0.3, 0.0, 0.2};
void DrawFunc() {
for (int i = 0; i < 3; ++i)
draw.sphere(obj_q[i][0], obj_q[i][1], 0, 0.1);
}
void IterFunc() {
// print output?
}
void main() {
Z.OnDraw = DrawFunc; //graphics event
Z.OnIter = IterFunc; //iteration event
Z.H(energy_H, dH, 0); //multiple objects
Z.H(energy_H, dH, 1);
Z.H(energy_H, dH, 2);
}
While some native graphics are supported without code, custom graphics support a wide range of practical graphical functions that work for both 2D and 3D display.
Open original interface image ↗
Further reading
- Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations Hairer, E., Lubich, C., & Wanner, G. (2002). Springer Series in Computational Mathematics, Vol. 31. Springer. DOI
- 3D time-dependent wave-packet approach in hyperspherical coordinates for the H + O₂ reaction on the CHIPR and DMBE IV potential energy surfaces Sun, Z., Yang, W., & Zhang, D. H. (2012). Physical Chemistry Chemical Physics, 14, 1827–1835. DOI
- Composition methods in the presence of small parameters McLachlan, R. I. (1995). BIT Numerical Mathematics, 35(2), 258–268. DOI
- Runge–Kutta methods for quadratic ordinary differential equations Iserles, A., Ramaswami, G., & Sofroniou, M. (1998). BIT Numerical Mathematics, 38, 315–346. DOI
- Practical splitting methods for the adaptive integration of nonlinear evolution equations. Part I: Construction of optimized schemes and pairs of schemes Auzinger, W., Hofstätter, H., Ketcheson, D., & Koch, O. (2017). BIT Numerical Mathematics, 57(1), 55–74. DOI
- High precision symplectic integrators for the Solar System Farrés, A., Laskar, J., Blanes, S., Casas, F., Makazaga, J., & Murua, A. (2013). Celestial Mechanics and Dynamical Astronomy, 116(2), 141–174. DOI
- Fourth-order symplectic integration Forest, E., & Ruth, R. D. (1990). Physica D: Nonlinear Phenomena, 43(1), 105–117. DOI
- Construction of higher order symplectic integrators Yoshida, H. (1990). Physics Letters A, 150(5–7), 262–268. DOI
- Fractal decomposition of exponential operators with applications to many-body theories and Monte Carlo simulations Suzuki, M. (1990). Physics Letters A, 146(6), 319–323. DOI
- Canonical Runge–Kutta–Nyström methods of orders five and six Okunbor, D. I., & Skeel, R. D. (1994). Journal of Computational and Applied Mathematics, 51(3), 375–382. DOI
- Runge–Kutta–Nyström symplectic splitting methods of order 8 Blanes, S., Casas, F., & Escorihuela-Tomàs, A. (2022). Applied Numerical Mathematics, 182, 14–27. DOI
- Symplectic methods for the numerical integration of the Schrödinger equation Monovasilis, T., & Simos, T. E. (2007). Computational Materials Science, 38(3), 526–532. DOI
- Practical splitting methods for the adaptive integration of nonlinear evolution equations Auzinger, W., Hofstätter, H., Ketcheson, D. I., & Koch, O. (2019). Computer Physics Communications, 234, 106–115. DOI
- High-order symplectic integration: an assessment Schlier, Ch., & Seiter, A. (2000). Computer Physics Communications, 130(1–2), 176–189. DOI
- Symplectic analytically integrable decomposition algorithms: Classification, derivation, and application to molecular dynamics, quantum and celestial mechanics simulations Omelyan, I. P., Mryglod, I. M., & Folk, R. (2003). Computer Physics Communications, 151(3), 272–314. DOI
- Practical symplectic partitioned Runge–Kutta and Runge–Kutta–Nyström methods Blanes, S., & Moan, P. C. (2002). Journal of Computational and Applied Mathematics, 142(2), 313–330. DOI
- Derivation of symmetric composition constants for symmetric integrators Sofroniou, M., & Spaletta, G. (2005). Optimization Methods and Software, 20(4–5), 597–613. DOI
- Optimized Fifth Order Symplectic Integrators for Orbital Problems Tselios, K., & Simos, T. E. (2013). Revista Mexicana de Astronomía y Astrofísica, 49(1), 11–24.
- The accuracy of symplectic integrators McLachlan, R. I., & Atela, P. (1992). Nonlinearity, 5(2), 541–562. DOI
- Composition constants for raising the orders of unconventional schemes for ordinary differential equations Kahan, W., & Li, R.-C. (1997). Mathematics of Computation, 66(219), 1089–1099. DOI
- Optimized Verlet-like algorithms for molecular dynamics simulations Omelyan, I. P., Mryglod, I. M., & Folk, R. (2002). Physical Review E, 65(5), 056706. DOI
- A canonical integration technique Ruth, R. D. (1983). IEEE Transactions on Nuclear Science, 30(4), 2669–2671. DOI
- Variable steps for symplectic integrators Calvo, M. P., & Sanz-Serna, J. M. (1993). SIAM Journal on Scientific and Statistical Computing, 14(4), 936–952. DOI
- On the numerical integration of ordinary differential equations by symmetric composition methods McLachlan, R. I. (1995). SIAM Journal on Scientific Computing, 16(1), 151–168. DOI
- Fifth Order Runge–Kutta–Nyström Methods with Complex Coefficients Gürkan, M. A. (2012). arXiv preprint arXiv:1203.3279. DOI
- Selection and improvement of product formulae for best performance of quantum simulation Morales, M. E. S., Costa, P. C. S., Pantaleoni, G., Burgarth, D. K., Sanders, Y. R., & Berry, D. W. (2022). arXiv preprint arXiv:2210.15817. DOI
- A tenth order symplectic Runge–Kutta–Nyström method Tsitouras, Ch. (1999). Celestial Mechanics and Dynamical Astronomy, 74(3), 223–230. DOI
- High order symplectic integrators for perturbed Hamiltonian systems Laskar, J., & Robutel, P. (2001). Celestial Mechanics and Dynamical Astronomy, 80(1–2), 39–62. DOI
- Explicit methods in extended phase space for inseparable Hamiltonian problems Pihajoki, P. (2015). Celestial Mechanics and Dynamical Astronomy, 121(3), 211–231. DOI
- Explicit symplectic approximation of nonseparable Hamiltonians: Algorithm and long time performance Tao, M. (2016). Physical Review E, 94(4), 043303. DOI
- Higher order explicit symmetric integrators for inseparable forms of coordinates and momenta Liu, L., Wu, X., Huang, G., & Liu, F. (2016). Monthly Notices of the Royal Astronomical Society, 459(2), 1968–1976. DOI
- Semiexplicit symplectic integrators for non-separable Hamiltonian systems Jayawardana, B., & Ohsawa, T. (2023). Mathematics of Computation, 92(339), 251–281. DOI
- Preservation of quadratic invariants by semiexplicit symplectic integrators for nonseparable Hamiltonian systems Ohsawa, T. (2023). SIAM Journal on Numerical Analysis, 61(3), 1293–1315. DOI
- Runge–Kutta methods determined from extended phase space methods for Hamiltonian systems McLachlan, R. I. (2025). Numerical Algorithms, 100(3), 983–993. DOI
- Pseudo-symplectic Runge–Kutta methods Aubry, A., & Chartier, P. (1998). BIT Numerical Mathematics, 38(3), 439–461. DOI
- Eight-stage pseudo-symplectic Runge–Kutta methods of order (4, 8) Stepanov, M. (2023). arXiv preprint arXiv:2301.09335. DOI
- Order conditions for nonlinearly partitioned Runge–Kutta methods Tran, B. K., Southworth, B. S., & Buvoli, T. (2025). Electronic Transactions on Numerical Analysis, 63, 171–198. DOI
- Efficient fourth order symplectic integrators for near-harmonic separable Hamiltonian systems Nielsen, K. M. E. (2015). arXiv preprint arXiv:1501.04345. DOI