﻿ Zymplectic

### Zymplectic project

High performance numerical platform for Hamiltonian systems

In dedication of scientific endeavours on and applications of explicit symplectic integrators, Zymplectic is an installation free, c/c++ based, high performance scientific computation toolbox that contains the single largest collection of symplectic partioned Runge-Kutta and Runge-Kutta-Nyström methods suitable for a wide range of differential equations with emphasis on Hamiltonian systems.

Windows x86-64 Zymplectic v.0.8.3 win64 gcc

Zymplectic v.0.8.3 win64 clang
Linux x86-64 Currently unavailable
See Documentation for technical instructions (currently obsolete)                              #### Introduction

Explicit symplectic integrators (SIs, singular SI) are numerical integration schemes for separable Hamiltonian systems: $$H=T(p)+V(q)$$ where H is the Hamiltonian typically associated with the energy of the system. T and V is typically associated with the kinetic and potential energy respectively. p and q denotes the canonical coordinates which are often associated with momentum and position obeying: $$\dot{p}= -\frac{\partial H}{\partial q}$$ $$\dot{q}= \frac{\partial H}{\partial p}$$ The time evolution of the autonomous and separable Hamiltonian system can be calculated numerically by canonical transformation of coordinates (q0,p0) → (qs,ps) over the time τ:

$$q_i=q_{i - 1} + \tau c_i\frac{\partial T}{\partial p}(p_{i - 1})$$ $$p_i=p_{i - 1} - \tau d_i\frac{\partial V}{\partial q}(q_i)$$ where s is the number of stages equal to the number of splitting coefficints c or d. The accuracy and integration order depends on the choice of the splitting coefficients.

SIs preserve the phase-space volume exactly and counteract dissipation of the initial Hamiltonian as opposed to well-acclaimed non-symplectic Runge-Kutta methods. SIs are widely used for long-time numerical integration in the fields of celestial mechanics, accelerator physics, molecular dynamics, and quantum chemistry, and in particular any form of state space analyses that are particularly vulnerable to dissipative errors.

The symplectic Euler method (first order) and the leapfrog method (second order) in spite of their poor accuracy are among the most acclaimed SIs, and are often used without the users' awareness of the symplectic properties.

The Hamiltonian is one of the qualitative physical properties of autonomous dynamical systems that is preserved throughout the numerical integration (see demo, left mouse to start simulation):

#### Applications

In addition to their common application, SIs may also be applied to systems where T or V depend explicitly on time, that are the so-called non-autonomous systems where the Hamiltonian is generally not conserved. $$H = T(p,t)+V(q,t)$$ While explicit system integrators are primarily intended for separable Hamiltonian systems it has been shown that they can be applied to non-separable systems which can not be separated into two terms T(p) and V(q) or in other words that T or V depend irreducibly on both q and p, and without loss of generality may or may not depend explicitly on time:

$$H = f(p,q,t)$$ for any sufficiently smooth function f. Finally, SIs while possibly waiving some symplectic properties, can have their use extended to a wide range of differential equations such as ordinary differential equations that may not be governed by a Hamiltonian.

#### The Zymplectic project

Zymplectic is vastly different from other differential equation libraries such as GSL or JuliaDiffEq. Zymplectic is primarily intended for Hamiltonian systems and only supports explicit symplectic integrators. The bundled binary of Zymplectic does not include a library with numerical methods. Instead Zymplectic is designed to load a c/c++ source file expressing the Hamiltonian system (e.g. TheSolarSystem.cpp), which is interpreted, compiled, loaded and simulated with any desired method, graphics and settings optionally set in the graphical user interface. Zymplectic automatically displays/retrieve relevant data, including simulated objects, the Hamiltonian error, energy surfaces and object trajectories. Users need not to know any large number of functions or calling conventions to make a simulation code, greatly reducing the abstraction of coding aiding the user in expressing advanced Hamiltonian systems. The c++ files loaded by Zymplectic are macro-augmented to further enhance the ease of use with no negative impact on flexibility or performance. Zymplectic is fully functional without installation and does not require any IDE or compilers since Zymplectic is bundled with either gcc or clang. Zymplectic includes the single largest online selection of symplectic integrators ranging from the symplectic Euler to high order symplectic Runge-Kutta (SPRK) as well as Runge-Kutta-Nyström (RKN) methods, all which are also available in text format for those who pursue to make their own implementations.

#### Showcases

List last updated 2021.02.04

### Zymplectic core features

Zymplectic is a numerical engine for simulating any separable, non-separable, autonomous and non-autonomous Hamiltonian systems.

• Prebuilt engine with no installation or compilation required
• Bundled with GCC or clang to dynamically compile c++ code
• Numerous example systems to be simulated with a single click
• Built-in Kahan summation for reducing truncation errors
• Practical 2D display of the simulation and integration error
• Biggest online library of SPRK and RKN integrator coefficients
• Benchmarking to identify the best methods for a given system
• Export integrators to c++ code to use in your own programs compile systems to C code (temporarily redacted)

#### Ease of use

Zymplectic requires only declarations of the Hamiltonian gradient, initial conditions and and a simple initialization to run. This is done in macro-augmented c++ code, allowing simple declarations of even very complex Hamiltonian systems. A simple but functional implementation of the Hénon-Heiles is shown below
const double lambda = 1.0;

double energy_H(Arg) { //Hamiltonian (optional)
double x2 = q1*q1;
double y2 = q2*q2;
return lambda*q2*(x2-y2/3.0) + 0.5*(x2 + y2 + p1*p1 + p2*p2);
}

dq1 = q1 + lambda*2.0*q1*q2;
dq2 = q2 + lambda*(q1*q1 - q2*q2);
dp1 = p1;
dp2 = p2;
}

double _q_init[] = {0.3,0.0}; //initial position
double _p_init[] = {0.0,0.4}; //and momentum

void main() {
Z.H(energy_H,dH,0);
}
Each object can also be paired with other objects or assigned to seperate kinetic and potential energies. This allows easy construction of more complicated physical systems with very few lines of code.

Zymplectic's interface includes the GUI control panel, an interactive glut-display window and an output console