Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Numerical simulations for the Toda lattices Hamiltonian system: Higher order symplectic illustrative perspective

  • Asif Mushtaq ,

    Roles Conceptualization, Data curation, Formal analysis, Investigation, Methodology, Project administration, Resources, Software, Supervision, Validation, Visualization, Writing – original draft, Writing – review & editing

    asif.mushtaq@nord.no

    Affiliation Seksjon for matematikk, FLU, Nord Universitet, N-8049 Bodø, Norway

  • Amna Noreen,

    Roles Investigation, Supervision

    Affiliation Seksjon for matematikk, FLU, Nord Universitet, N-8049 Bodø, Norway

  • Muhammad Asif Farooq

    Roles Conceptualization

    Affiliation Department of Mathematics, School of Natural Sciences (SNS), National University of Sciences and Technology (NUST), Islamabad 44000, Pakistan

Abstract

In this paper we apply some higher order symplectic numerical methods to analyze the dynamics of 3-site Toda lattices (reduced to relative coordinates). We present benchmark numerical simulations that has been generated from the HOMsPY (Higher Order Methods in Python) library. These results provide detailed information of the underlying Hamiltonian system. These numerical simulations reinforce the claim that the symplectic numerical methods are highly accurate qualitatively and quantitatively when applied not only to Hamiltonian of the Toda lattices, but also to other physical models. Excepting exactly integrable models, these symplectic numerical schemes are superior, efficient, energy preserving and suitable for a long time integrations, unlike standard non-symplectic numerical methods which lacks preservation of energy (and other constants of motion, when such exist).

1 Introduction

Hamiltonian equations of motion belong to a class of ordinary differential equations (ODEs) which in general are difficult or mostly impossible to solve analytically. Consider a separable Hamiltonian written in the form (1) where T(p) is the non-relativistic kinetic energy, V(q) is the potential energy and M is the inverse mass matrix. The autonomous Hamiltonian equations of motion constitute a system of first order ordinary differential equations, (2) where qa and pa are generalized coordinates of positions and momenta, respectively. The ” ˙ ” denotes differentiation with respect to time t, and H = H(q, p). The initial conditions at t = 0 can be written as, We define Eq (2) in abbreviated form as, (3) (4) where J is a skew-symmetric matrix. Further I and 0 represent the unit and zero matrices, respectively. The compact conservative Hamiltonian system in differential form is, (5)

The above equations of motion are equivalent to Newton’s second law of mechanics with conservative forces. The dynamics generated by these equations define, for each evolution time, a mapping between regions of phase space. A general feature of these mappings is that they preserve the volume of the regions being mapped (and some related properties, collectively referred to as the symplectic structure). The standard non-symplectic numerical integrators, that have been used to solve general initial value problems numerically, do not preserve this qualitative behaviour, or the constants of motion for the system. Examples of such numerical integrators are the classical Runge-Kutta methods of different order, as found in standard integration packages.

By contrast the geometrical numerical integrators have gained popularity in the scientific community, due to their geometry preserving properties, in order to find qualitatively better solutions to Hamiltonian problems. In physical systems energy preservation, symmetries, time-reversal invariance, symplecticity, angular momentum, phase-space volume and dissipation are some key and crucial components to understand geometric properties. Detailed discussions of symplectic integrators with geometric properties have been given in [14].

Since the symplectic solvers have been widely accepted to be superior than the conventional numerical methods for solving the Hamiltonian systems, Mushtaq et. al. [5] constructed a well behaved class of higher order symplectic integrators schemes based on the extensions of the Störmer-Verlet scheme for Hamiltonians like Eq (1). An overview of these extensions are presented in Section 3. In this paper, we apply these schemes to the Toda lattice models.

The new proposed (KiMoKi) schemes involve extensive calculations of higher order derivatives of the Hamiltonian; hence it becomes a nightmare to do correct implementations manually. A collection of Python program HOMsPy (Higher Order Methods in Python) has been developed and presented by Mushtaq and Olaussen [8] to overcome these cumbersome and error-prone calculations for higher accuracy. More details, with implementation of many applications, can be found tutorial on HOMsPY by Mushtaq [9].

The structure of the rest of this paper is as follows: In Section 2 we review the Toda lattice models. These are integrable, nonlinear systems that have a number of extra constants of motions beyond standard ones like energy and momentum. The form of these can be described in a very consise manner by Eqs (7) and (8). In Section 3 we review the construction of the KiMoKi class of symplectic numerical solvers. In Section 4 we present and discuss the numerical simulations of the Toda lattice models by use of these methods. In Section 5 we conclude the main body of paper with brief remarks. Some technical details are delegated to appendices.

2 Toda lattices

The periodic Toda lattice with sites (or particles) can, in suitable dimensionless coordinates, be specified by the Hamiltonian [10], (6) where qa and pa are phase-space coordinates of positions and momenta respectively, and the index a is interpreted modulo (i.e., ). This mode belongs to a more general class of lattice models where the nearest-neighbour potential, exp(q) − 1, is replaced by an arbitrary function V(q). Another famous member of this class is the Fermi-Pasta-Ulam-Tsingou problem, with V(q) = q2/2 − αq3/3 + βq4/4. The original study by Fermi et. al. [11] only treated linear chains with fixed endpoints, and parameter choices for which αβ = 0.

Integrability is one of the most important properties of the Toda lattices. The model describes a set of equal mass particles moving on a ring with exponentially decreasing nearest neighbour interactions. The phase-space coordinates can be used to define a symmetric, periodic tridiagonal (time dependent) matrix, (7) where va = −e(qaqa+1)/2. It was shown by Flaschka [12], using theory developed by Lax [13], that the eigenvalues λa of L remain unchanged if the evolution qa(t), pa(t) is generated by the Hamiltonian of Eq (6). This means that all quantities (8) are constants of motions. The first two are familiar, general expressions, (9a) (9b) The third one is a special consequence of integrability, (9c) where the last term is just an uninteresting constant, since v1v2v3 = 1 when .

It may not be easy to discover a general prescription like the one above. Alternative methods to find additional conservation laws (when one suspects that such exists) are the more brute force type of searches used by Göktaş et. al. [14] and Hohler et. al. [15]. They started by deducing the general form of a possible conservation law, with unknown coefficients, and next tried to explicitly solve for the coefficients with the help of computer algebra. This is a more pedestrian and cumbersome approach, but may be more likely to succeed when applied to models with unknown properties.

2.1 The 3-particle case

For it is simple to introduce center-of-mass and relative coordinates. A common physicists choice is Jacobi coordinates with corresponding conjugate momenta (see Appendix A), This separates the Hamiltonian into center-of-mass and internal contributions, , with (10a) In a similar manner we may rewrite , with (10b) A direct evaluation of dC3⊥/dt, using the Hamilton equations generated by H, confirms that it vanishes. I.e., that C3⊥ indeed is a constant of motion.

The Hamiltonian of Eq (10a) can be rewritten by a canonical scale transformation, followed by a change of time and mass units (see Appendix B), , . This transforms Eq (10a) to the expression used by Lunsford and Ford [16], (11) With the same transformations the conserved quantity of Eq (10b) can be expressed as (12) If the potential in Eq (11) is expanded to third order in the coordinates q1, q2, one obtains the Henon-Heiles [17] Hamiltonian This is the motivation for the form by Lunsford and Ford [16]. The KiMoKi solvers have already been implemented for the Henon-Heiles model by Mushtaq [9], and used to detect chaotic and non-chaotic regions of that model. The former occur for oscillations of larger amplitude, for which the higher order terms in the Toda lattice Hamiltonian become of importance. This explains why chaotic behaviour may occur in the Henon-Heiles model, but not in the Toda lattice models (since they are integrable).

3 An overview to construct the higher order symplectic scheme

One idea for construction of a symplectic integrator for the evolution generated by a Hamiltonian, is to replace it with an iterated sequence of short-time evolutions generated by respectively T(p) (moves, which changes q without changing p) and V(q) (kicks, which changes p without changing q), since each of these are exactly integrable. This is the Störmer-Verlet scheme, which in its symmetrized form has a global error scaling like the timestep squared, τ2. One way to achieve higher accuracy is by replacing T and V by effective quantities, TTeff and VVeff, in a systematic manner. The effective quantities will depend on the timestep τ, and the wanted order N of accuracy, τN. In the kick-push-move-kick scheme proposed by Mushtaq et. al. [5], Veff is still a function of q only (in addition to τ); hence it can still be treated a potential, only slightly changed. Then this is no longer possible for Teff; it must depend on both p and q. However, what is really needed is not the infinitesimal generator Teff(p, q; τ), but its corresponding, sufficiently accurate, finite (but short) time generator G(q, P; τ). The latter can be constructed in a systematic manner: (13) such that the transformation (q, p) → (Q, P) is defined by (14a) (14b) which preserves the symplectic structure exactly, reproduces the time evolution generated by Teff to order τN. Here Qa is shorten for qa(t + τ), and Pa shorten for pa(t + τ). The change in momentum p (of order τ3—i.e. a gentle push) is then defined through an implicit equation (but one which has turned out to be unproblematic to solve by iteration for all cases tried), while the change in position q continues to be explicit. Hence, the evolution step generated by G consists of a move, accompanied with a gentle push.

Define K such that 2K + 2 is the order of the method, where K = 1, 2, 3 and K = 0 corresponds to the Störmer-Verlet scheme. One full time step with this modification for kick-push-move-kick scheme is,

  1. “Kick”: (15a) (15b)
  2. “Push”: (15c) (15d) But Pa is unknown yet. We have to solve a nonlinear equation to find Pa. However our generating function takes the form, (15e) Hence Eq (14a) can be written as, or in a form suitable for an iterative solution,
  3. “Move”: (15f) (15g)
  4. “Kick”: (15h) (15i)

The explicit expressions for V2k and Gk were published by Mushtaq et. al. in ref [5]. For convenience, on request from a reviewer, they are included in Appendix D.

To implement these higher order methods for our Toda lattice Hamiltonian, we define the model by the code in Listing 1 of Appendix C, and use programs in the HOMsPy package to automatically generate all the KiMoKi solver code. The complete code package is available as “Supporting information” for this paper.

4 Numerical simulations with HOMsPy

As has been mentioned before, numerical simulations on several Hamiltonian systems with the algorithm outlined by Eq (15) has compared favourable to conventional non-symplectic methods. We here present the results of additional simulations, of the model defined by Eq (11), which strengthen this evidence further.

As mentioned earlier that we implemented these numerical schemes as Python routines in HOMsPy. Python is an open source programming language which has gained increasing popularity in general, including (successful) applications for scientific computing. It is fast and easy to code and use for small “prototyping” tasks, since there is no need for explicit declaration of variables or a separate compilation cycle. It also comes with a huge repository of packages covering a large area of applications. Python is equipped with other features which facilitates development and encourages documentation of large well-structured program systems. Obviously, as an interpreted language, native Python is not suitable for performing extended numerical computations. But very often the code for such computations reduces to calls to pre-compiled library routines.

4.1 Preservation of constants of motion

We have already stressed the advantage of using symplectic solvers for numerical analysis of Hamiltonian models. This is most important when simulating long time series, where conventional numerical algorithms (like the Runge-Kutta methods usually implemented in numerical packages) can lead to a continuous degradation of important qualitative properties of Hamiltonian systems, like symplecticity (preservation of phase space volume and related quantities) and constants of motion. These methods have no built-in mechanisms for preserving such properties, as is illustrated in this subsection.

As the name suggests, symplectic solvers preserve symplecticity exactly. There will, of course, always be errors caused by numerical roundoff, but such errors do not depend on the accuracy of the method, only on the numerical precision being used. Symplectic solvers do not preserve most other constants of motion exactly, but the error (deviation from the initial value) will oscillate in a narrow band around zero. The width of this band scales with the accuracy of the method (i.e., order and timestep) in the expected way. For the symplectic (KiMoKi) algorithms used in this paper, applicable to Hamiltonians of the form H = T(p) + V(q), a constant of motion is preserved exactly if it is conserved separately by T and V. In this paper, one such example is the total momentum P of Eq (9a), while H of Eq (9b) and C3 Eq (9c) are not.

It has been proven that symplectic integrators that preserve the Hamiltonian must actually be exact solvers (modulo errors introduced by finite numerical precision). There exist special methods for integrable models, as f.i. discussed by Kuznetsov and Vanhaecke [6] and Zullo [7]. The KiMoKi integrators, aimed for a more general class of problems, are not able to provide exact solutions, at least not when the conventional coordinates are used.

In this subsection we compare the KiMoKi solvers of order 2 and 4 with the RK23 (order 2) and RK45 (order 4) Runge-Kutta methods available through the solve_ivp routine in the scipy.integrate package, for the same values of the timestep τ (for the Runge-Kutta solvers, τ is the maximum timestep).

There are additional methods available in solve_ivp, but they are—for this comparison—inferior to the Runge-Kutta ones.

As can be seen from Figs 1 and 2, for short times the Runge-Kutta accuracy may very well be better than the KiMoKi ones, but as time increases it steadily becomes worse. By comparing Figs 1 and 2, we note that the time interval in which the Runge-Kutta methods are competitive becomes larger with decreasing τ.

thumbnail
Fig 1. This figure illustrates how well exactly conserved quantities are preserved by our symplectic numerical solvers, compared to the standard Runge-Kutta methods implemented in scipy.integrate.solve_ivp.

For the 3-site Toda lattice, reduced to relative coordinates, the constants of motion are the Hamiltonian H of Eq (11) and of Eq (12). Here ΔH = [H(t) − H(0)]/H(0), calculated from the numerical solutions, and similar for ΔC3⊥. Here τ is the fixed timestep of the sympletic solvers.

https://doi.org/10.1371/journal.pone.0215054.g001

4.2 Poincaré section technique (surface-of-section)

The reduced 3-site Toda lattice model we investigate has 4 degrees of freedom, z ≡ (q1, q2, p1, p2). Even in this rather simple case it is a challenge to present and visualize how the solutions behave. One, quite popular and efficient method, is the Poincaré section technique (also known as surface-of-section), introduced by Henri Poincaré the early 20th century. Generally, for cases where energy is conserved, H(q1, q2, p1, p2) = H0, each orbit is restricted to a 3-dimensional constant energy surface of 4-dimensional phase space. The points where one coordinate is kept fixed (for example q2 = 0) define another, in general independent, 3-dimensional surface. The intersection of these two surfaces is therefore two-dimensional. It can be specified by two coordinates, for example (q1, p1). In this example, the points (q1(tn), p1(tn)) where the constant energy orbit crosses the q2 = 0 surface are therefore easy to visualize in two-dimensional plots. The times tn of crossings, and the order of repeated crossings, will be lost (or visualized by other means).

Repeated crossings will generate a pattern which indicates the nature of the dynamics. In our case, where there is an additional constant of motion (C3⊥), repeated crossings will appear on two smooth curves—one for each direction in which the (q2 = 0)-plane is crossed, determined by the initial conditions. For ergodic motion, the crossings should spread smoothly over or more regions of the plane, according to density predicted by classical statistical mechanics. According to KAM theory, perturbations of integrable models are expected to lie in-between: For a finite fraction of initial condition, the crossings will appear on a smooth curve, while the rest will appear to be spread over a region of finite area.

Cheb-Terrab and de Oliveira [18] have written a MapleV R.3 routine for visualizing Hamiltonian dynamics by the Poincaré section technique. They employ the Toda lattice model for usage demonstration. We have implemented their algorithm in python, in combination with the KiMoKi solvers. The algorithm uses linear interpolation to determine crossings; hence it is of limited accuracy and is best used with short time-steps τ. (All our code could have been implemented in Maple, but this framework is not freely available to all.)

Fig 3 shows 4000 crossings of the orbit with the (q1 = 0)-plane, 2000 in each direction, using KiMoKi solvers of order 2 (left panel) and 4 (right panel) with timestep τ = 0.005. For the left panel the initial condition is z0 = (0, 1, 9.95, 10). The corresponding constants of motions are H0 = 100, C3⊥ = −15852.7. For the right panel the initial condition is z0 = (0, 1, 19.98, 10). The corresponding constants of motion are H0 = 250, C3⊥ = 16117.7.

thumbnail
Fig 3. Poincaré sections for an orbit of the reduced 3-site Toda lattice model of Eq (11).

Each panel shows 4000 crossings of the (q1 = 0)-plane, 2000 in the positive direction (p1 > 0, marked blue), and 2000 in the negative direction (p1 < 0, marked red). The dynamics between each crossing is determined by KiMoKi solvers of order 2 (left panel) resp. 4 (right panel), with timestep τ = 0.005. The initial condition is z0 = (0, 1, 9.95073, 10), with H0 = 100, C3⊥ = −15852.72982, for the left panel, and z0 = (0, 1, 19.97541, 10), with H0 = 250, C3⊥ = 16117.70199, for the right panel.

https://doi.org/10.1371/journal.pone.0215054.g003

Fig 4 shows 4000 crossings of the orbit with the (q2 = 0)-plane, 2000 in each direction, using a KiMoKi solver of order 6 with timestep τ = 0.01. For the left panel the initial condition is z0 = (1, 0, 22, 5.05). The corresponding constants of motion are H0 = 256, C3⊥ = 72099.45. For the right panel z0 = (0, 0.1, 1.41, 0.1). The corresponding constants of motion are H0 = 1, C3⊥ = 23.51.

thumbnail
Fig 4. Poincaré sections for an orbit of the reduced 3-site Toda lattice model of Eq (11).

Each panel shows 4000 crossings of the (q2 = 0)-plane, 2000 in the positive direction (p2 > 0, marked blue), and 2000 in the negative direction (p2 < 0, marked red). The dynamics between each crossing is determined by a KiMoKi solver of order 6, with timestep τ = 0.01. The initial condition is z0 = (1, 0, 22, 5.04993), with H0 = 256, C3⊥ = 72099.45264, for the left panel, and z0 = (0, 0.1, 1.40733), with H0 = 1, C3⊥ = 23.51188 for the right panel.

https://doi.org/10.1371/journal.pone.0215054.g004

Fig 5 shows 4 000 crossings of the orbit with the (q2 = 0)-plane (left panel) or the (q1 = 0)-plane (right panel), 2 000 in each direction, using a KiMoKi solver of order 8 with timestep τ = 0.05. For the left panel the initial condition is z0 = (0.1, 1, 0.1, 1.41). The corresponding constants of motion are H0 = 1, C3⊥ = −6.45. For the right panel z0 = (0, 1, 6.93, 1). The corresponding constants of motion are H0 = 25, C3⊥ = 2597.68.

thumbnail
Fig 5. Poincaré sections for an orbit of the reduced 3-site Toda lattice model of Eq (11).

The left panel shows 4 000 crossings of the (q2 = 0)-plane, 2 000 in the positive direction (p2 > 0, marked blue) and 2 000 in the negative direction (p2 < 0, marked red). The right panel similarly shows 4 000 crossings of the (q1 = 0)-plane. The dynamics between each crossing is determined by a KiMoKi solver of order 8, with timestep τ = 0.05. The initial condition is z0 = (0.1, 0, 0.1, 1.40709), with H0 = 1, C3⊥ = −6.45412, for the left panel, and z0 = (0, 1, 6.92943, 1), with H0 = 25, C3⊥ = 2597.68431, for the right panel.

https://doi.org/10.1371/journal.pone.0215054.g005

4.3 3D camera plots of each orbit

An alternative method to visualize the solution behaviour is to make a projection to a 3-dimensional subspace, and display the orbit in a “3-dimensional” plot. This is best done in interactive sessions, since this allows one to vary the viewing direction over all possible spherical angles. Snapshots examples from such matplotlib sessions are shown in Figs 6 and 7, for phase space orbits {z(t)|0 ≤ t ≤ 2 000}. Each plot displays quasi-periodic motion on a two-dimensional surface determined by the initial value z0 (or more precisely the corresponding constants of motion, H0 and C3⊥).

thumbnail
Fig 6. A quasi-periodic orbit z(t) for times 0 ≤ t ≤ 2000, found by the KiMoKi solvers of order N = 2 (left panel) and order N = 4 (right panel) with timestep τ = 0.1, projected to respectively the (q1, q2, p2) (left) and (q1, q2, p1) (right) subspaces.

The initial condition z0 = (0.1, 0, 0.1, 1.40709), with H0 = 1, C3⊥ = −6.45412. The viewing angle is set to (ϑ, φ) = (68, 78) (left), respectively (ϑ, φ) = (−128, −8). Here ϑ is the elevation angle (elev) and φ the azimuth angle (azim).

https://doi.org/10.1371/journal.pone.0215054.g006

thumbnail
Fig 7. A quasi-periodic orbit z(t) for times 0 ≤ t ≤ 2000, found by the KiMoKi solvers of order N = 6 (left panel) and order N = 8 (right panel) with timestep τ = 0.1, projected to respectively the (q1, q2, p2) (left) and (q1, q2, p1) (right) subspaces.

The initial condition z0 = (0.1, 0, 0.1, 1.40709), with H0 = 1, C3⊥ = −6.45412. The viewing angle is set to (ϑ, φ) = (15, −87) (left), respectively (ϑ, φ) = (−128, 133). Here ϑ is the elevation angle (elev) and φ the azimuth angle (azim).

https://doi.org/10.1371/journal.pone.0215054.g007

4.4 Behavior of energy error

We have earlier in Section 4.1 and Figs 1 and 2 shown that the long time behaviour of the KiMoKi solvers are better than the standard Runge-Kutta solvers of the same order, with respect to preservation of constants of motion. In Fig 8 we show that this behaviour can be observed for all orders N of the KiMoKi solvers, with the accuracy increasing with N for a fixed timestep τ. As can be seen, the errors keep varying in an oscillating manner, with no noticeable increase in amplitude with time.

thumbnail
Fig 8. Long time energy error for solutions of a Toda lattice model computed by the KiMoKi solvers.

An orbit z(t) with initial value z0 = (0.1, 0, 0.1, 1.40709), corrsponding to H0 = 1 and C3⊥ = −6.45412. The solution is computed for times 0 ≤ t ≤ 5 000 with timestep τ = 0.1; for better visibility only the last hundred time units are plotted.

https://doi.org/10.1371/journal.pone.0215054.g008

In Fig 9 we further show that the error scales with order N and timestep τ in the expected manner. I.e., proportional with τN, with a N-dependent constant of proportionality.

thumbnail
Fig 9. Scaled energy errors for some higher order symplectic integrators, when applied to the reduced 3-site Toda lattice Hamiltonian of Eq (11).

The plots are for an orbit z(t) with initial value (0.1, 0, 0.1, 1.40709), corresponding to H0 = 1, C3⊥ = −6.45412, computed with KiMoKi solvers of orders N = 2, 4, 6, 8, and timesteps τ = 0.025, 0.05, and 0.1.

https://doi.org/10.1371/journal.pone.0215054.g009

5 Concluding remarks

In this paper, the KiMoKi algorithms for numerical solutions of the Hamilton equations for a Toda lattice model have been discussed and tested. These methods preserve the symplectic structure exactly (within the accuracy given by the employed numerical precision); For order N = 2 the method is equal to the Störmer-Verlet scheme, with long-time accuracy of order τ2; it has been extended to methods of order τ4, τ6 and τ8. As demonstrated, the method works as expected (sometimes even better than expected) for the reduced 3-site Toda lattice model.

A brief summary of this work is as follows:

  • The symplectic property is preserved provided we solve the non-linear Eq (14a) for push steps to sufficient accuracy.
  • Without prior knowledge the quasi-periodic nature of the solutions can easily be detected from 3D plots of the orbits (projected to 3-dimensional subspaces). Further (but not independent) confirmation can be found by investigating the behaviour of the Poincaré section of each orbit.
  • Although the KiMoKi solver do not preserve constants of motion exactly, the time oscillating error in these quantities do not systematically increase in “amplitude” with time. This amplitude can be reduced in a predictable manner by increasing the order N of the method, or decreasing the timestep τ, or both.

A Jacobi coordinates for few-body systems

Consider first a translation invariant Hamiltonian system with two non-relativistic particles of mass m1 resp. m2, with position coordinates q1 resp. q2. To exploit translation invariance it is common to introduce center-of-mass and relative coordinates, (16a) where μj = mj /(m1 + m2), for j = 1, 2. For common systems with conjugate momenta and , the new momenta become (16b) The linear transformation of Eq (16) is canonical (because the matrices Mq in Eq (16a) and Mp in Eq (16b) are related by ) and maintains the diagonal form of the kinetic energy. In the equal-mass case, , the matrices Mq and Mp do not become orthogonal. The latter, which can be obtained by scale transformations of X and x, may look simpler and more natural from a mathematical point of view. However, this would obscure physical interpretation of the coordinates.

The inverse of Eq (16) is (17a) (17b) The extension to three particles is obvious for the center-of-mass coordinate, and one may further maintain the previous definition of one relative coordinate. As a second relative coordinate, select the distance between the center-of mass of the first two particles, and the third one. Hence (18a) where now μj = mj/(m1 + m2 + m3) for j = 1, 2, 3 and for j = 1, 2. The new conjugate momenta becomes respectively (18b)

The inverse of Eq (18) is (19a) (19b) For the case of equal masses, and .

B Unit transformations

Most quantities in physical expressions, like the Hamiltonian are dimensionful. I.e., they carry units of time, length, and mass. When expressed in dimensionless form like in Eq (6) or Eq (10a), this means that the dimensionless time t, length , and mass m actually are expressed in terms of some reference quantities t0, 0, m0. I.e., a dimensionless potential energy V(q) = e(qaqa + 1) must be interpreted to mean , and the factor in the dimensionless kinetic energy must be interpreted to mean . In “units where t0 = 0 = m0 = 1”. Consider now a change of reference units to (20) with all physical quantities fixed. It is rather obvious that dimensionless coordinates will change as (21a) (21b) (21c) In this context, the statement t → λt t is shorthand for i) a change of reference units , implying ii) the transformation of Eq (21a), often followed by iii) a symbol renaming back to the original one, .

The corresponding transformations of V(q) and are less obvious, (21d) (21e) and cannot be deduced from the dimensionless expressions without knowledge of which physical quantity they represent (energy in this case).

C Code snippets

In this section we provide some information of how the routines in the HOMsPY package can be used to create the symplectic solvers for the Toda lattice Hamiltonian, and how these solvers can be used to solve an initial value problem from provided initial data.

The package itself can downloaded from the CPC Program Library at http://cpc.cs.qub.ac.uk/summaries/ADTV, by providing the Catalogue Id AESD v1.0. The code, with accompanying information which need not be repeated here, is found by unpacking the downloaded .tar-file. Since the package is written Python 2.7, we provide code snippets illustrating how the solvers can be accessed by Python 3 code.

One way to continue is to add the code in Listing 1 to the examples/makeExamples.py file. But for our project we made a new folder TodaLattice, and added it to a new file makeTodaLattices.py.

Listing 1. Constructing KiMoKi solvers for a Toda lattice model

def makeTodaLattices():

 # Choose names for coordinates and momenta

 q1, q2, p1, p2 = sympy.symbols([’q1’, ’q2’, ’p1’, ’p2’])

 qvars = [q1, q2]; pvars = [p1, p2]

 # Define potential in terms of coordinates

 V = (exp(2*q2+2*sqrt(3)*q1) + exp(2*q2-2*sqrt(3)*q1) + exp(-4*q2) − 3)/24

 kimoki.makeModules(’TodaLattices’, V, qvars, pvars, DP = True, MP = True, MAXORDER = 8, VERBOSE = True)

By running this code several files will be created. The most important one is TodaLattices.py, which contains the KiMoKi solvers up to 8th order. This file should not be modified manually; is not intended to be studied in detail by humans. But (in particular) the multiprecision code should be checked against unintended conversions to floating point numbers. F.i., if the final division /24 in the above definition of V is replaced by a pre-multiplication (1/24)*, then this factor will be converted to a double precision number at an early stage, and thereby pollute all multiprecision accuracy.

The file runTodaLattices.py provide some usage examples, intended to be modified and extended. Since this file will be overwritten the next time makeTodaLattices is executed, it is recommended to work on a renamed copy.

The current version of the HOMsPY package, with all its output, is written in Python 2.7. But functions can be accessed from Python 3 through an interface like the one in Listing 2. Data exchange via pickle files may seem primitive, but this has the advantage of documenting (preserving) the arguments and data being used.

Listing 2. Python 3 code calling Python 2.7 function.

def get_ivpsoln(**kwargs):

 ″″″Solve an initial value problem by use of KiMoKi.

The KiMoKi solver routines are currently written in Python2.7. This is a simple Python 3 interface using ’subprocess.call()’. Arguments and results are communicated via pickle files, for which some care with protocol and encoding is required.″″″

 # Default arguments:

 args = {’argfile’: ’ivpargs’, ’soln’: ’ivpsoln’, ’tau’: 0.05, ’tmax’: 50., ’order’: 4, ’z0’: (0., 0., 5., 5.)}

 args = {**args, **kwargs} # Override defaults

 if not os.path.isfile(f″./{args[’soln’]}.pkl″):

  with open(f″{args[’argfile’]}.pkl″, ’wb’) as outfile:

   pickle.dump(args, outfile, protocol = 2)

  subprocess.call([″python2″, ″./run todalattices.py″, ″solve_ivp″, args[’argfile’]])

 with open(f″{args[’soln’]}.pkl″, ’rb’) as infile:

  soln = pickle.load(infile, encoding=’latin1’)

 return soln

On the Python 2.7 side we copied runTodaLattices.py to run_todalattices.py. All existing functions except computeSolution(…) can be deleted, and the function in Listing 3 must be added.

Listing 3. Python 2.7 function called from Python 3.

def solve_ivp(argfile):

 ″″″Interface to python3 code through a subprocess call.

Calling arguments (’args’), and the returned solution (’zt’) are communicated through pickle files.″″″

 # All arguments with default values

 args = {’tmax’: 50., ’tau’: 0.05, ’order’: 4, ’z0’: (0., 0., 5., 5.), ’soln’: ″ivpsoln″}

 with open(argfile, ’rb’) as infile:

  kwargs = pickle.load(infile)

 for key, value in kwargs.items():

  args[key] = value # Override defaults

 tmax, tau = args[’tmax’], args[’tau’]

 nMax = 1+int(tmax/tau)

 z0 = numpy.array(args[’z0’])

 zt = computeSolution(z0, tau, args[’order’], nMax)

 with open(″%s.pkl″ % args[′soln′], ′wb′) as outfile:

  pickle.dump(zt, outfile)

Further, the last two blocks in run_todalattices.py were changed to the one of Listing 4.

Listing 4. Python 2.7 main entry point

funcs = {’solve_ivp’: solve_ivp, ’find_sections’: find_sections

if __name__ == ″__main__″:

 ″″″Execute the function named by sys.argv[1], with argument sys.argv[2].

 ″″″

 argc = len(sys.argv)

 func = sys.argv[1] if argc > 1 else ″solve_ivp″

 argfile = ″%s.pkl″ % sys.argv[2] if argc > 2 else ″args.pkl″

 funcs[func](argfile)

D Explicit expressions

On request from a reviewer we here for convenience include the explicit expressions used in the algorithms of Eq (15). The rest of this section is an essentially unedited copy of a section with the same name, previously published by Mushtaq and Olaussen [8]:

Explicit (but compact) expressions for the terms of order τ2, τ4, and τ6 were given in [5, 19]. With the notation, where the Einstein summation convention is employed (an index which occur twice, once in lower position and once in upper position, are implicitly summed over all available values; i.e, Mabb ≡ ∑b Mabb—we generally use the matrix M to rise an index from lower to upper position), they are (22a) (22b) (22c) (22d) (22e) (22f) In this last line we have introduced (23) The kick-steps can still be integrated directly, since the V2k’s only depend on q. However, the T2k’s (for k ≥ 1) in general depend on both q and p; hence the move-steps cannot be integrated directly. To overcome this problem we introduce a generating function (24) such that the transformation (q, p) → (Q, P) defined implicitly by (25) preserves the symplectic structure exactly, and reproduce the time evolution generated by Teff to order τN. Here Qa is shorthand for qa(t + τ), and Pa shorthand for pa(t + τ). The explicit expressions for the coefficients are (26a) (26b) (26c) (26d) (26e) (26f) (26g) (26h) (26i)

The Eqs (22,26) define the kick-move-kick scheme for a general potential V. If one uses all the listed terms the local error becomes of order τ9, and the scheme will respect long-time conservation of energy to order τ8.

Acknowledgments

A. Mushtaq and A. Noreen would like to thank Prof. Kåre Olaussen for his valuable contributions in the collaborated research that forms the basis of this paper, and for informative discussions about Toda lattice models. They further thank the Department of Mathematics, FLU, Nord University for research support enabling parts of this work to be done.

References

  1. 1. Hairer E, Lubich C, Wanner G. Geometric Numerical Integration. Structure-Preserving Algorithms for Ordinary Differential Equations. 2nd ed. Berlin: Springer; 2006. Available from: https://doi.org/10.1007/3-540-30666-8.
  2. 2. McLachlan RI, Quispel GRW. Geometric integrators for ODEs. Journal of Physics A: Mathematical and General. 2006;39(19):5251–5285.
  3. 3. McLachlan RI, Quispel GR. In: Devore R, Iserles A, Süli E, editors. Six lectures on the geometric integration of ODEs. London Mathematical Society Lecture Note Series. Cambridge University Press; 2001. p. 155–210. Available from: https://doi.org/10.1017/CBO9781107360198.008.
  4. 4. Hairer E. In: Long-time energy conservation of numerical integrators. Foundations of computational mathematics, Santander 2005. Cambridge: Cambridge University Press; 2006. p. 162–180. Available from: https://doi.org/10.1017/CBO9780511721571.005.
  5. 5. Mushtaq A, Kværnø , Olaussen K. Higher-Order Geometric Integrators for a Class of Hamiltonian Systems. International Journal of Geometric Methods in Modern Physics. 2014;11(01):1450009–1–20.
  6. 6. Kuznetsov V, Vanhaecke P. Bäcklund transformations for finite-dimensional integrable systems: a geometric approach. Journal of Geometry and Physics. 2002;44(1):1–40.
  7. 7. Zullo F. Bäcklund transformations and Hamiltonian flows. Journal of Physics A: Mathematical and Theoretical. 2013;46(14):145203.
  8. 8. Mushtaq A, Olaussen K. Automatic code generator for higher order integrators. Computer Physics Communications. 2014;185(5):1461–1472.
  9. 9. Mushtaq A. Numerical Geometric Integration with HOMsPy. IAENG Int J of App Math. 2015;45(4):383–391.
  10. 10. Toda M. Vibration of a Chain with Nonlinear Interaction. Journal of the Physical Society of Japan. 1967;22(2):431–436.
  11. 11. Fermi E, Pasta J, Tsingou M, Ulam SM. Studies of nonlinear problems. I; 1955. LANL report LA-1940. Available from: https://www.osti.gov/servlets/purl/4376203.
  12. 12. Flaschka H. The Toda lattice. II. Existence of integrals. Phys Rev B. 1974;9:1924–1925.
  13. 13. Lax PD. Integrals of nonlinear equations of evolution and solitary waves. Communications on Pure and Applied Mathematics;21(5):467–490.
  14. 14. Ünal Göktaş, Hereman W, Erdmann G. Computation of conserved densities for systems of nonlinear differential-difference equations. Physics Letters A. 1997;236(1):30–38.
  15. 15. Hohler EGB, Olaussen K. Conservation laws for the classical Toda field theories. Modern Physics Letters A. 1993;08(35):3377–3385.
  16. 16. Lunsford GH, Ford J. On the Stability of Periodic Orbits for Nonlinear Oscillator Systems in Regions Exhibiting Stochastic Behavior. Journal of Mathematical Physics. 1972;13(5):700–705.
  17. 17. Henon M, Heiles C. The applicability of the third integral of motion: Some numerical experiments. Astronomical Journal. 1964;69:73–79.
  18. 18. Cheb-Terrab ES, de Oliveira HP. Poincaré sections of Hamiltonian systems. Computer Physics Communications. 1996;95(2):171–189.
  19. 19. Asif Mushtaq, Anne Kværnø and Kåre Olaussen. Systematic Improvement of Splitting Methods for the Hamilton Equations. Proceedings of the World Congress on Engineering, London July 4–6. 2012;(I):247–251.