Keywords

1 Introduction

The equations of molecular dynamics (MD) are ordinary Hamilton differential equations describing the interaction of material particles. MD equations have an exact analytical solution in a very limited number of cases [8]. Therefore, in the general case, these equations are solved numerically using difference schemes in which the differential operator is replaced by a difference operator.

When solving the Hamilton equations, it is natural to use difference schemes that preserve the symplectic properties of these equations. Violation of this condition leads to non-conservation of Poincaré invariants and the appearance of non-physical instability in numerical calculations. It follows that the difference operator of the numerical scheme must have the properties of a canonical transformation. The corresponding difference schemes are called symplectic.

This work is a continuation of the works of the authors [15, 16], which provide a detailed overview of the methods for constructing symplectic schemes. In [15, 16], symplectic schemes were considered in relation to the MD method, in which the Hamiltonian of interacting particles splits into the sum of kinetic and potential energy. It was shown that the problem of constructing symplectic schemes of a given order of accuracy with a fixed number of stages is reduced to the problem of finding the roots of a polynomial system of equations that arise when the coefficients in the expression for the error of the scheme are turned to zero. It turned out that the use of the Gröbner basis technique [1] implemented in the Mathematica computer algebra system makes it possible to find the roots of a system of polynomial equations in the case when its Vandermonde determinant is zero. With the help of this technique, 21 new four-stage schemes of the 4th order of accuracy were obtained [16].

This paper presents a generalization of the method proposed in [15, 16] to the more general case when the Vandermonde determinant of a system of polynomial equations is nonzero. The effectiveness of the proposed method is demonstrated by the example of a four-stage scheme of the 4th order of accuracy. 96 new symplectic four-stage schemes of the 4th order of accuracy of the Forest–Ruth type were obtained. The error functional for several of the best new schemes is two orders of magnitude smaller than for the Forest–Ruth scheme [6].

Verification of schemes is carried out by comparing the numerical solutions with the exact solution of the test problem. It is shown that the new Forest–Ruth four-stage schemes with the smallest norm of the leading error term provide a more accurate preservation of a balance in total energy of the particle system than the schemes of the same formal approximation order with a larger approximation error.

2 Governing Equations

For simplicity, consider the Hamilton’s equations for a single particle in the one-dimensional case:

$$\begin{aligned} dx/dt=p/m,~\quad dp/dt=f(x),\quad f(x)=-\partial H(x)/\partial x,~H=\frac{p^2}{2m}+V(x), \end{aligned}$$
(1)

where t is the time, x is the coordinate, p is the momentum, m is the particle mass, f is the force acting on the particle, V(x) is the potential energy, \(p^2/(2m)\) is the kinetic energy, H is the Hamiltonian.

Hamilton’s equations (1) generate a one-parameter group of diffeomorphisms \(x^0\rightarrow x(t,x^0)\) [5]. The smooth functions z(xp) form the algebra of the Lie group with respect to the Poisson bracket [5]

$$\begin{aligned} \frac{dz}{dt}=\{z,H\},\quad \{z,H\}= \left( \frac{\partial H}{\partial p} \frac{\partial z}{\partial x}-\frac{\partial H}{\partial x}\frac{\partial z}{\partial p}\right) \,. \end{aligned}$$
(2)

Let us rewrite these equations in the operator form

$$\begin{aligned} \frac{dz}{dt}= \hat{L} z,\quad \hat{L}=\left( \frac{\partial H}{\partial p} \frac{\partial }{\partial x}-\frac{\partial H}{\partial x}\frac{\partial }{\partial p}\right) \,, \end{aligned}$$
(3)

where \(\hat{L}\) is the Liouville operator. Write the solution of Eq. (3) in the form

$$\begin{aligned} z(t)=\hat{U} z(0),~\hat{U}=\exp (\hat{L}t),~\hat{L}=\hat{L}_1+\hat{L}_2,~ \hat{L}_1=\frac{\partial H}{\partial p}\frac{\partial }{\partial x},~\hat{L}_2= -\frac{\partial H}{\partial x}\frac{\partial }{\partial p}. \end{aligned}$$
(4)

Propagators \(\hat{U}\) form a one-parameter Lie group and satisfy the group relations

$$\begin{aligned} \hat{U}(t_1) \hat{U}(t_2)=\hat{U}(t_1+t_2),\quad \hat{U}^{-1}=\exp (-\hat{L}t),\quad \hat{U}(0)=I,\quad \hat{U}\hat{U}^{-1}=I. \end{aligned}$$
(5)

Equations (4) underlie the propagator method of constructing symplectic schemes [3, 7, 9, 18].

3 Symplectic Partitioned Runge–Kutta Schemes

PRK schemes are based on the propagator method, which is determined by relations (4). In the case of a separable Hamiltonian, they have the following form:

$$\begin{aligned} \begin{aligned}&z(t)=\hat{U}z(0),~\hat{U}=\exp [(\hat{L}_1+\hat{L}_2)t],\\&\hat{L}_1=\frac{p}{m}\frac{\partial }{\partial x}, \hat{L}_2=f(x)\frac{\partial }{\partial p},~f(x)=-\frac{\partial V}{\partial x}. \end{aligned} \end{aligned}$$
(6)

If the values \(z^n=(x^n,p^n)\) are known at the nth time layer \(t^n\), then we obtain at the \((n+1)\)th time layer \(t^{n+1}=t^n+h\)

$$\begin{aligned} z^{n+1}=\exp ((\hat{L}_1+\hat{L}_2)h)z^n. \end{aligned}$$
(7)

Let us subdivide the passage from \(t^n\) to \(t^{n+1}\) into K stages. Let us approximate the propagator (7) by a product of propagators with the accuracy \(O(h^{\lambda +1})\):

$$\begin{aligned} \exp [(\hat{L}_1+\hat{L}_2)h]= \prod _{s=1}^K\exp (d_s h\hat{L}_1)\exp (c_sh\hat{L}_2)+ O(h^{\lambda +1}), \sum _{s=1}^Kc_s=1,~\sum _{s=1}^K d_s=1. \end{aligned}$$
(8)

Thus, the solution at the \((n+1)\)th time layer is given with the accuracy of \(O(h^{\lambda })\) by the equation

$$\begin{aligned} \begin{aligned}&z^{n+1}=\prod _{s=1}^K\exp (d_s h\hat{L}_1)\exp (c_s h\hat{L}_2)z^n,\\&z^K=z^{n+1}=(x^{n+1},p^{n+1}),~z^{(0)}=z^n=(x^n,p^n). \end{aligned} \end{aligned}$$
(9)

We obtain from Eqs. (7) and (9) that at the passage from the \((i-1)\)th stage to the ith stage, the following relations are valid [6]:

$$\begin{aligned} p^{(i)}=p^{(i-1)}+c_ih f(x^{(i-1)}),\quad x^{(i)}=x^{(i-1)}+d_i\frac{h}{m}p^{(i)}, \quad i = 1,\ldots ,K, \end{aligned}$$
(10)

which satisfy the condition \(J=\frac{\partial (p^i,x^i)}{\partial (p^{i-1},x^{i-1})}=1\). Note that one can use instead of (9) the expansion (in the notation of the work [18]) of the form

$$\begin{aligned} z^{n+1}= \prod _{s=1}^K\exp (d_s h\hat{L}_2)\exp (c_s h\hat{L}_1)z^n, \end{aligned}$$
(11)

which leads to the relations [18]

$$\begin{aligned} x^{(i)}=x^{(i-1)}+c_i \frac{h}{m} p^{(i-1)},\quad p^{(i)}=p^{(i-1)}+d_i hf(x^{(i)}), \quad i=1,\ldots ,K, \end{aligned}$$
(12)

which also satisfy the condition \(J=1\). Equations (10) and (12) define the class of explicit symplectic schemes the accuracy of which is determined by the number of stages K and coefficients \(c_i,d_i\).

Below we show how new sets of parameters of a four-stage multiparameter family of Forest–Ruth symplectic schemes (10) can be obtained analytically using Gröbner bases. Some of these schemes have a much smaller norm of the leading error term than the two four-stage schemes obtained in [6].

4 Forest–Ruth Scheme

Consider scheme (10) with \(K=4\). Using symbolic calculations, it is not difficult to obtain an expression for the error \(\delta p_n\) in the form [16]

$$\begin{aligned} \delta p_n= & {} hP_1f(x) +(h^2/2) P_2 u(t)f'(x)+ h^3[P_{31}f(x)f'(x)/m + P_{32}u^2 f''(x)]/6\nonumber \\ \!\!\!+ & {} (h^4u)/(24m)\{P_{41}\cdot [f'(x)]^2+3P_{42}f(x)f''(x)+ P_{43} mu^2f^{(3)}(x)\}\nonumber \\ \!\!\!- & {} [h^5/(120m^2)](3P_{51}f^2(x)f''(x)+f(x)(P_{52}\cdot [f'(x)]^2- 6P_{53}mu^2f^{(3)}(x)\nonumber \\ \!\!\!- & {} mu^2(5P_{54}f'(x)f''(x)+P_{55}mu^2f^{(4)}(x))), \end{aligned}$$
(13)

where u(t) is the particle velocity. The expressions for \(P_1,P_2,P_{31},P_{32}\), \(P_{41}\), \(P_{42}\), \(P_{43},P_{51},P_{52},P_{53},P_{54}\), and \(P_{55}\) are available in [16], and we give here only the expression for \(P_1\) for the sake of brevity: \(P_1= 1 - c_1 - c_2 - c_3 - c_4\).

Let us calculate the weighted root-mean-square value of five polynomials \(P_{5j}\), \(j=1,\ldots ,5\):

$$\begin{aligned} P_{5,rms}^{(l)}=\bigl [(1/5)\sum \limits _{j=1}^5 (\sigma _j P_{5j})^2\bigr ]^{\frac{1}{2}}. \end{aligned}$$
(14)

Here \(\sigma _1,\ldots ,\sigma _5\) are problem-independent factors affecting the polynomials \(P_{5j}\) in (13), \(\sigma _1=-3\), \(\sigma _2=-1\), \(\sigma _3=6\), \(\sigma _4=5\), \(\sigma _5=1\). The error \(\delta x_{n}\) obtained when calculating the coordinate \(x^{n+1}\) according to the scheme under consideration is given by the formula

$$\begin{aligned} \begin{array}{l} \delta x_{n}=\frac{hp}{m}R_1+\frac{h^2}{2m}R_2 f(x)+\frac{h^3}{6m} R_3 u(t) f'(x)+ \frac{h^4}{24m^2}[R_{41} f(x)f'(x)\\[1mm] +R_{42}mu^2\!f''(x)] \frac{h^5 u(t)}{120\,m^2}\{R_{51}[f'(x)]^2\!+3R_{52} f(x)f''(x)+R_{53}mu^2f^{(3)}(x)\}. \end{array} \end{aligned}$$
(15)

The expressions for \(R_1\), \(R_2\), \(R_{3}\), \(R_{41}\), \(R_{42}\), \(R_{51}\), \(R_{52}\), and \(R_{53}\) are available in [16], and we give here only the expression for \(R_1\) for the sake of brevity: \(R_1= 1 - d_1 - d_2 - d_3 - d_4\).

Table 1. The values of the parameters of the Forest–Ruth schemes FRl (\(l=1,\ldots ,6\)) obtained in the case of the zero determinant (17)
Table 2. The values of the parameters of the Forest–Ruth schemes FRl, \(l=7,\ldots ,10\) in the particular cases of \(c_1=0\) and \(d_4=0\)

The system of equations \(P_1=0\), \(P_2=0\), \(P_{32}=0\), \(P_{43}=0\) is linear in \(c_i\), \(i=1,\ldots ,4\). It is easy to rewrite it in the form \(\mathcal{P}{} \mathbf{c}=\mathbf{b}\), where \(\mathbf{c}=(c_1,c_2,c_3,c_4)^T\), \(\mathbf{b} = (1,\frac{1}{2},\frac{1}{3},\frac{1}{4})^T\), and

$$\begin{aligned} \mathcal{P}=\left( \begin{array}{cccc} 1 &{}~ 1 &{}~ 1 &{}~ 1 \\ 0 &{}~ d_1 &{}~ {(}d_1+d_2{)^2} &{}~ {(}d_1 + d_2 +d_3 {)^2} \\ 0 &{}~ d_1^2 &{}~ (d_1+d_2)^2 &{}~ (d_1 + d_2 +d_3)^2 \\ 0 &{}~ d_1^3 &{}~ (d_1+d_2)^3 &{}~ (d_1 + d_2 +d_3)^3 \\ \end{array} \right) . \end{aligned}$$
(16)

The determinant of this matrix is as follows:

$$\begin{aligned} \text{ det }\,\mathcal{P}=d_1d_2d_3(d_1+d_2)(d_2+d_3)(1 - d_4). \end{aligned}$$
(17)

The values \(c_i\) obtained from the system \(P_1=0\), \(P_2=0\), \(P_{32}=0\), \(P_{43}=0\) have the form of fractional rational functions whose numerators are polynomials in \(d_1,\ldots ,d_4\), and denominator is the determinant (17). If \(\text{ det }\,\mathcal{P}=0\), then it will be problematic to find expressions for \(c_i\). In this connection, all six particular cases of the vanishing determinant (17) were considered in detail in [16]. The following polynomial system was handled therein:

$$\begin{aligned} R_1= 0,~ P_1=0, ~ P_2=0, ~ P_{31}= 0, ~ P_{32} = 0, ~ P_{41} = 0, ~ P_{42} = 0, ~ P_{43}= 0. \end{aligned}$$
(18)

The number of equations in (18) is equal to the number of unknowns \(c_1,c_2,c_3,c_4\), \(d_1,d_2,d_3,d_4\). We found with the aid of Gröbner bases six new analytical solutions of the above system, which are summarized in Table 1. The values \(z,\zeta \), \(\varphi _1,\varphi _2^{\pm },\varphi _3\) were calculated as follows:

$$\begin{aligned} \begin{array}{l} z=\sqrt{3}, ~\zeta =2^{1/3}, ~\varphi _1^{\pm }=\frac{1}{6}(3\pm z), ~\varphi _2^{\pm }=\frac{1}{12}(3\pm 2z),\\[1mm] ~\varphi _3=\frac{1}{12}(4+2\zeta +\zeta ^2), ~\varphi _4=-\frac{1}{3}(1+\zeta )^2. \end{array} \end{aligned}$$
(19)

In Table 1 and in further similar tables, we give for brevity only the first three values of the parameters \(c_i,d_i\), \(i=1,2,3\). The numerical values of the parameters \(c_4\) and \(d_4\) can be calculated using the formulas: \(c_4=1-c_1-c_2-c_3\), \(d_4=1-d_1-d_2-d_3\).

Earlier in the work [6], cases were considered when either \(c_1=0\) or \(d_4=0\); at the same time, additional symmetry conditions of the scheme were imposed: \(d_2=d_3\), \(d_1=d_4\) (at \(c_1=0\)) and \(c_2=c_3\), \(c_1=c_4\) (at \(d_4=0\)). We also considered in [16] special cases when either \(c_1=0\) or \(d_4=0\), but did not impose symmetry conditions. At \(c_1=0\), two solutions coincide with those obtained for \(d_3=-d_2\), and the third solution coincides with the one given in [6]. For \(d_4=0\), a unique real solution was obtained that coincides with the solution (4.9) from [6]. A more detailed description of these solutions is given in [16], see also Table 2, where symmetric schemes are marked with an asterisk.

Along with (14), we also introduce the functional \( X_{5,rms}^{(l)}\), which represents the weighted root-mean square value of three polynomials \(R_{5j}\), \(j=1,2,3\):

$$\begin{aligned} X_{5,rms}^{(l)}=\left\{ \left[ R_{51}^2+ (3R_{52})^2+R_{53}^2\right] /3\right\} ^{1/2}. \end{aligned}$$
(20)

This formula accounts for multiplier “3” before \(R_{52}\) in (15). In the following, we will not give the magnitudes of the functionals \(P_{5,rms}^{(l)}\) and \(X_{5,rms}^{(l)}\) separately for each scheme, but we will give them in a summary Table 19.

One can see from Table 19 that in the cases of symmetric schemes FR9 and FR10, the value \(P_{5,rms}^{(l)}\) obtained from the leading term of the scheme error is greater than in the cases of nonsymmetric schemes. Thus, although symmetric schemes allow calculations in the direction of decreasing time (\(h<0\)), they are less accurate than nonsymmetric schemes (according to the latter schemes, problems can be solved only at \(h>0\), i.e., moving in the direction of increasing time).

4.1 The General Case

In general, when the determinant (17) is nonzero, expressions for polynomials (18) become more complicated. The Mathematica command

$$\begin{aligned} \begin{aligned} \mathtt {GroebnerBasis[}&\mathtt {\{P1,R1,P2,P31,P32,P41,P42,P43\},} \\&\mathtt {\{c1,c2,c3,c4,d1,d2,d3,d4\}]} \end{aligned} \end{aligned}$$
(21)

has enabled the obtaining of the Gröbner basis \(\{G_1,\ldots ,G_{19}\}\), which consists of 19 polynomials. The polynomial system is termed zero-dimensional if it has a finite number of complex solutions. A zero-dimensional system with as many equations as variables is sometimes said to be well-behaved [10]. The Bézout theorem asserts that a well-behaved system of n equations, which have degrees \(d_1,\ldots ,d_n\), has at most \(d_1\cdots d_n\) solutions. In our case, the polynomials \(P_1,R_1,P_2\), \(P_{31},P_{32}\), \(P_{41},P_{42}\), and \(P_{43}\) have according to [16] the degrees 1, 1, 2, 3, 3, 4, 4, 4, respectively. Thus, system (18) has at most 1152 complex and real roots counted with their multiplicities.

Unfortunately, in the Gröbner basis obtained from (21), there is no univariate polynomial. The shortest polynomials in the resulting basis are the polynomials \(G_1\) and \(G_2\), moreover, \(G_1=\mathcal{G}_1(d_3,d_4)\), \(G_2=\mathcal{G}_2(d_2,d_3,d_4)\). In order for the system \(G_1=0,~G_2=0\) to have a common root, it is necessary that its resultant, based on the Sylvester matrix, be zero [2, 4]. The polynomials \(G_1\) and \(G_2\) depend collectively on three variables \(d_2,d_3\), and \(d_4\). It follows that one needs to consider three options for excluding variables: excluding the variable \(d_2\), excluding the variable \(d_3\), and excluding the variable \(d_4\). Therefore, we have considered three resultants: \(\text{ Res }(G_1,G_2,d_4)\), \(\text{ Res }(G_1,G_2,d_3)\), \(\text{ Res }(G_1,G_2,d_2)\).

In the CAS Mathematica, the symbolic computation of the resultant is implemented in the function Resultant[...]. The command Resultant[G1,G2,d4] eliminates the variable \(d_4\). As a result, it has been found that

$$\begin{aligned} \text{ Res }(G_1,G_2,d_4)= A_{54}d_3\mathcal{F}_4(d_3)\mathcal{F}_8(d_3) \mathcal{F}_{13}(d_2,d_3)[\mathcal{F}_{14}(d_3)]^2\mathcal{F}_{56}(d_3). \end{aligned}$$
(22)

Here \(A_{54}\) is a constant consisting of 54 decimal digits, \(\mathcal{F}_4(d_3)= -1-16 d_3-96 d_3^2-36 d_3^3+324 d_3^4\). The value \(d_3=0\) is one of the solutions of the Eq. (22). However, it was mentioned above that with this value of the parameter \(d_3\), the system (18) is incompatible. The solution of the equation \(\mathcal{F}_4(d_3)=0\) is in radicals, but its substitution into system (18) leads to giant symbolic expressions.

On the other hand, the roots of this equation can be found numerically with very high accuracy. But all the same, the real roots found are approximate. Substituting the root \(d_3\), given as a floating-point machine number, into the original polynomial system (18) turns this system into a polynomial system with approximate coefficients. In the review paper [11], problems related to obtaining approximate Gröbner bases from polynomial systems with approximate coefficients were discussed. Here we note the following two problems.

  • In principle, approximate solutions of the original polynomial system can be obtained from the approximate Gröbner basis. But substituting the found solution into the original system leads to the residuals that are several decimal orders of magnitude greater than machine rounding errors; this was shown in a number of examples in [11].

  • There exists the problem of ill-conditioned polynomials [12, 17]. The presence of errors in the coefficients of a poorly conditioned polynomial can even lead to a change in the number of real roots of the polynomial equation [17].

In cases where it is not possible to find solutions to a polynomial system in an analytical form, it is more reliable to search for these solutions by numerically solving an optimization problem formulated directly for the polynomials included in the original system. This methodology was described in [15, 16].

Table 3. The values of the parameters of the Forest–Ruth schemes FRl (\(l=11,\ldots ,14\)) obtained in the case of the zero resultant (23)

For the resultant \(\text{ Res }(G_1,G_2,d_3)\), the following expression is obtained:

$$\begin{aligned} \begin{array}{l} \text{ Res }(G_1,G_2,d_3)=103129560704(3d_4-1)^9(4d_4-1)^5(1-9d_4+24d_4^2)^9\\ \times \mathcal{F}_{12}(d_2,d_4)[\mathcal{F}_{14}(d_4)]^6. \end{array} \end{aligned}$$
(23)

Expressions for polynomials \(\mathcal{F}_{12}(d_2,d_4)\) and \(\mathcal{F}_{14}(d_4)\) are not given here because of their bulky appearance.

It follows from (23) that the value \(d_4=1/3\) is one of the roots of the equation \(\text{ Res }(G_1,G_2,d_3)=0\). Substituting this value into the polynomial system (18) significantly simplifies the appearance of the polynomials included in the system. This makes it easy to find the corresponding Gröbner basis consisting of seven polynomials \(G_1,\ldots ,G_7\). The Gröbner polynomial \(G_1\) yields the following quartic equation for \(c_1\): \(G(1) = -25+340 c_1-1920 c_1^2+3840 c_1^3+1152 c_1^4=0\). Its roots are expressed in radicals, we omit them for brevity. Two of these roots are real. Since the Gröbner basis is triangular, the parameters \(d_3,d_2,d_1\), \(c_4,c_3,c_2\) are easily found. The corresponding schemes in Table 3 are the schemes FR11 and FR12. The case of \(d_4=1/4\) was handled similarly to the foregoing case. The corresponding schemes in Table 3 are the schemes FR13 and FR14. The roots of the equation \(1-9d_4+24d_4^2=0\) are complex.

And finally, \(\text{ Res }(G_1,G_2,d_2)= 1\). It is a polynomial of degree zero, that is, it does not contain any of the variables \(d_2,d_3,d_4\). Therefore, this resultant is useless when searching for solutions for these three variables.

Below we will show that with the help of parametric Gröbner bases, it is possible to obtain several dozen of further exact solutions of polynomial systems arising from the study of PRK schemes. At the same time, we can declare any of the eight variables \(c_j,d_j\), \(j=1,\ldots ,4\) as a parameter. Following [10], we will call the quantities that are not included in the set of parameters, the indeterminates.

Our goal is to search for schemes in the Forest and Ruth family for which the functionals \(P_\mathrm{5,rms}\) and \(X_\mathrm{5,rms}\) are smaller than in the cases of symplectic schemes described in [15, 16]. Taking into account the previous considerations for working with parametric Gröbner bases, we have developed and implemented a procedure consisting of seven steps in the CAS Mathematica language.

Step 1. For certainty, consider the case when the variable \(c_4\) is declared as a parameter. Then the Gröbner basis of system (18) is computed using the call

$$\begin{aligned} \begin{aligned} \mathtt {GroebnerBasis[}&\mathtt {\{P1,R1,P2,P31,P32,P41,P42,P43\},} \\&\mathtt {\{c1,c2,c3,d1,d2,d3,d4 \}]} \end{aligned} \end{aligned}$$
(24)

By default, in all subsequent calls to the function GroebnerBasis[...], lexicographic ordering of monomials is used. We will show in the following that the Gröbner basis of the same polynomial system also depends on the order of the indeterminates in the call to the Mathematica function GroebnerBasis[...].

Step 2. The Gröbner basis \(\{G_1,G_2,\ldots , G_N\}\) (\(N>2\)) obtained with the aid of the call (24) has no univariate polynomial. The first two polynomials \(G_1\) and \(G_2\) have the smallest length. We introduce for further convenience the notation: \(\alpha _j=c_j\), \(\alpha _{j+4}=d_j\), \(j=1,\ldots ,4\). As a rule, \(G_1=\mathcal{F}_1(\alpha _{i_1},\alpha _{i_2})\), \(G_2=\mathcal{F}_2(\alpha _{i_1},\alpha _{i_2},\alpha _{i_3})\), where \(1\le i_1,i_2,i_3\le 8\), \(i_1\ne i_2\), \(i_2\ne i_3\), \(i_1\ne i_3\). Then we calculate the following three resultants:

$$\begin{aligned} \text{ Res }(G_1,G_2,\alpha _{i_k}),\quad k=1,2,3. \end{aligned}$$
(25)

The elimination of the variable \(\alpha _{i_k}\) from the basis polynomials \(G_1\) and \(G_2\) is carried out with the aid of the call \(\text{ Res }[G_1,G_2,\alpha _{i_k}]\).

Step 3. All three resultants (25) are considered. First, using the Mathematica function Factor[...] we find out whether a particular resultant from the set (25) is factorizable. Some of the resultants (25) are irreducible over the field \({\mathbb Q}\) of rational numbers. Below we will briefly write “irreducible polynomials”.

Step 4. All integer and rational roots of the equations \(\text{ Res }(G_1,G_2,\alpha _{i_k})=0\), \(k=1,2,3\) are found.

Step 5. Each of the found roots \(\alpha _j\in {\mathbb Q}\) is substituted into system (18) and then the corresponding Gröbner basis is found. As a rule, this basis turns out to be triangular. In this case, the polynomial \(G_1\) is univariate. If its degree is 2, 3 or 4, then the roots of the equation \(G_1=0\) are in radicals. In order to avoid the appearance of giant symbolic expressions when substituting these closed-form roots into the remaining basic polynomials, the roots are translated into machine numbers with a mantissa length of 50 decimal digits \(0,1,\ldots ,9\). To do this, we use the Mathematica function SetAccuracy[root,50].

If the degree of \(G_1\) is higher than 4, then the solution of the equation \(G_1=0\) is found with high accuracy using the command NSolve[G[[1]]==0,c4, WorkingPrecision-> 50]. Due to the fact that the Gröbner basis is triangular, all the required unknowns \(\alpha _j\), \(j=1,\ldots ,8\) are then easily found.

Step 6. Among the roots of each of the three resultants (25), there may be extraneous roots [13]. Therefore, verification of all found roots of system (18) is carried out by substituting them into this system.

Step 7. The functionals \(P_\mathrm{5,rms}^{(l)}\) and \(X_\mathrm{5,rms}^{(l)}\) are calculated according to (14) and (20) as criteria for evaluating the accuracy of the obtained real symplectic schemes.

The \(\boldsymbol{c_1}\) Parameter. In this case, (21) is replaced with the call

$$\begin{aligned} \begin{aligned} \mathtt {GroebnerBasis[}&\mathtt {\{P1,R1,P2,P31,P32,P41,P42,P43\},}\\&\mathtt {\{c2,c3,c4,d1,d2,d3,d4\}]} \end{aligned} \end{aligned}$$
(26)

The Gröbner basis \(\{G_1,G_2,\ldots \}\) is obtained as 18 polynomials, with \(G_1=\mathcal{F}_1(c_1,d_4)\) and \(G_2=\mathcal{F}_2(c_1,d_3,d_4)\). Therefore, we have considered three resultants: \(\text{ Res }(G_1,G_2,d_4)\), \(\text{ Res }(G_1,G_2,c_1)\), and \(\text{ Res }(G_1,G_2,d_3)\). The first of them is

$$\begin{aligned} \begin{aligned}&\text{ Res }(G_1,G_2,d_4) =\\ {}&A(c_1\!-1)^{10}(3c_1\!-1)^{17}(4c_1-1)^6(24 c_1^2\!-9 c_1\!+1)^{18} [\mathcal{F}_{12}(c_1)]^7\mathcal{F}_{16}(c_1,d_3). \end{aligned} \end{aligned}$$
(27)
Table 4. The values of the parameters of the Forest–Ruth schemes FRl (\(l=15,\ldots ,23\)) obtained in the case of the zero resultants (27) and (30)

Here \(A=8077716527296737705984\). The system of equations \(G_1=0\), \(G_2=0\) has a common root if and only if the resultant \(\text{ Res }(G_1,G_2,d_4)=0\). It follows from (27) that this equality holds, in particular, in the following cases: \(c_1=1\), \(c_1=1/3\), and \(c_1=1/4\). Below we will look at all these cases.

Substituting the value \(c_1=1\) into the polynomial system (18) makes it easy to find the corresponding Gröbner basis \(\{G_1,\ldots ,G_7\}\), which proves to be triangular. It is then easy to find numerical values of all parameters from it. The equation \(G_1=0\) has three real roots and two complex conjugate roots. The schemes FR15, FR16, and FR17 in Table 4 correspond to three real roots.

In the case when \(c_1=1/3\), a triangular Gröbner basis is also obtained. The Gröbner polynomial \(G_1\) is univariate and it yields the following quartic equation for \(d_4\): \(960 d_4^4-3552 d_4^3+1778 d_4^2-340 d_4+25=0\). Its roots are expressed in radicals, we omit them for brevity. Two of these roots are real. The corresponding schemes in Table 4 are the schemes FR18 and FR19 (see also [16]). The case of \(c_1=1/4\) is handled similarly to the case of \(c_1=1/3\), the corresponding schemes in Table 4 are the schemes FR20 and FR21 (see also [16]).

The equation \(24 c_1^2\!-9 c_1\!+1=0\) has no real roots. The equation \(\mathcal{F}_{12}(c_1)=0\) has two real roots and five pairs of complex conjugate roots. At the same time, there is no rational root among the real roots. Obtaining an approximate Gröbner basis leads to the difficulties discussed above at the beginning of this subsection.

In an effort to get several further roots of the equation \(\text{ Res }(G_1,G_2,d_4)=0\), we substitute the value of \(c_1=1\) into the polynomial \(\mathcal{F}_{16}(c_1,d_3)\). As a result, we obtain the equation \(\mathcal{F}_{16}(1,d_3)=-36(4418 - 34584 d_3 + 93477 d_3^2 - 87708 d_3^3 - 11520 d_3^4 + 36864 d_3^5)=0\). This equation has three real roots and two complex conjugate roots. The real roots are as follows: -1.858323611577820880, 0.4493418810217388717, and 0.9577284766792059415. It is easy to see that these values of the parameter \(d_3\) coincide with those given in Table 4 for schemes FR17, FR16, and FR15. The substitution of the value \(c_1=1/3\) in \(\mathcal{F}_{16}(c_1,d_3)\) has enabled us to obtain an equation \(\mathcal{F}_{16}(1/3,d_3)=0\) whose roots give the schemes FR18 and FR19. Finally, the equation \(\mathcal{F}_{16}(1/4,d_3)=0\) gives as the output the familiar schemes FR20 and FR21. Thus, the equation in question did not add new roots.

The resultant \(\text{ Res }(G_1,G_2,c_1)=0\) is as follows:

$$\begin{aligned} \begin{array}{l} \text{ Res }(G_1,G_2,c_1) = A_{50}(d_4-1)^2 (3 d_4-1) (4 d_4-1) (24 d_4^2-9 d_4+1)^3\\ \times \mathcal{F}_3(d_4)\mathcal{F}_4(d_4) \mathcal{F}_6(d_4)[\mathcal{F}_8(d_4)]^2\mathcal{F}_{10}(d_3,d_4)[\mathcal{F}_{12}(d_4)]^2\mathcal{F}_{60}(d_4), \end{array} \end{aligned}$$
(28)

where \(A_{50}\) is a large integer number containing 50 decimal digits. The polynomials \(\mathcal{F}_3(d_4)\), \(\mathcal{F}_4(d_4)\), \(\mathcal{F}_6(d_4)\), \(\mathcal{F}_8(d_4)\), \(\mathcal{F}_{10}(d_3,d_4)\), \(\mathcal{F}_{12}(d_4)\), and \(\mathcal{F}_{60}(d_4)\) are not presented here for the sake of brevity. The case when \(d_4=1\) was already considered above, see the schemes FR5 and FR6 in Table 1. The cases when \(d_4=1/3\) and \(d_4=1/4\) were already considered above, see Table 3.

The third resultant \(\text{ Res }(G_1,G_2,d_3)\) is the 13th degree irreducible polynomial in two variables \(c_1\) and \(d_4\). It adds no new solutions to system (18).

Table 5. Successful permutations

We have used above in the call (26) to the Mathematica function GroebnerBasis[..] the sequence of the indeterminates in the form c2,c3,c4,d1,d2,d3, d4. Below we show that permutation of elements in this sequence can lead to new solutions of the original polynomial system. To do this, consider instead of (26) the following call to the function GroebnerBasis[...]:

$$\begin{aligned} \begin{aligned} \mathtt {GroebnerBasis[}&\mathtt {\{P1,R1,P2,P31,P32,P41,P42,P43\},}\\&\mathtt {\{d1,d2,d3,d4,c2,c3,c4\}]} \end{aligned} \end{aligned}$$
(29)

In this case, a Gröbner basis is obtained in which \(G_1=\mathcal{G}_1(c_1,c_4)\), \(G_2=\mathcal{G}_2(c_1,c_3,c_4)\). Therefore, we have considered three resultants: \(\text{ Res }(G_1,G_2,c_4)\),

\(\text{ Res }(G_1,G_2,c_3)\), and \(\text{ Res }(G_1,G_2,c_1)\). The first of them is as follows:

$$\begin{aligned}&\text{ Res }(G_1,G_2,c_4)=A_{20} (4c_1-1)^{6}(6c_1-1)^{12}(24c_1^2-9c_1+1)^{7}\nonumber \\ {}&\times (27c_1^2-10c_1+1)^5(96c_1^3-60c_1^2+12c_1-1)^5[\mathcal{F}_{25}(c_1)]^{7}. \end{aligned}$$
(30)

Here \(A_{20}\) is an integer consisting of 20 decimal digits. The equation \(\text{ Res }(G_1,G_2\), \(c_4)=0\) has two rational roots \(c_1=1/4\) and \(c_1=1/6\). Root \(c_1=1/6\) is a new root that is missing in (27) and (28). Its consideration leads to two new schemes FR22 and FR23, see Table 4.

The resultant \(\text{ Res }(G_1,G_2,c_3)\) is an irreducible polynomial of the 13th degree in two variables \(c_1\) and \(c_4\). The third resultant has the following form: \(\text{ Res }(G_1,G_2,c_1) =A_{72}c_4^2(8c_4^2-7c_4+2)^2(64c_4^3-40c_4^2+8c_4+1)[\mathcal{F}_{6}(c_4)]^2 \mathcal{F}_8(c_4)\times \) \(\mathcal{F}_{12}(c_3,c_4)\mathcal{F}_{125}(c_4)\). The root \(c_4=0\) of the equation \(\text{ Res }(G_1,G_2,c_1)=0\) has proved to be an extraneous root of the polynomial system (18).

The above two examples of using different sequences of seven indeterminates point to the following: if we want to find as many solutions of the original polynomial system as possible, then we must consider all permutations of the indeterminates. In the case of seven indeterminates, the number of permutations is equal to 7! = 5040. For each particular permutation, one needs to get three resultants based on the first two polynomials included in the Gröbner basis.

To do this, one first needs to get expressions for \(G_1\) and \(G_2\) and see which specific indeterminates and parameters they depend on. As a rule, \(G_1\) and \(G_2\) depend on two indeterminates and one variable selected as a parameter. Thus, we need to consider \(5040\cdot 3=15120\) resultants. The whole procedure could be implemented in the language of the Mathematica system. However, this requires considerable programming effort. Instead of such a complete analysis of all 5040 permutations, we considered the permutations \(P_j\) with the following numbers j: \(j = 8,16,24,32,40,48,56,64,72\), 80, 88, 96, 104, 1000, 2000, 3000, 4000, 5000. In Table 5, not all of these permutations are given, but only those that led to new solutions for the eight unknowns \(c_j,d_j\), \(j=1,\ldots ,4\). To obtain all permutations of seven elements, the Mathematica function Permutations[perm0] was used. Here perm0 is the initial permutation, we took \(perm0=\{d_1,d_2,d_3,d_4,c_2\), \(c_3,c_4\}\).

Table 5 contains a number of new solutions for the unknowns \(c_j\) and \(d_j\). We have at first considered six cases when \(c_j=0\), \(j=2,3,4\) or \(d_j=0\), \(j=1,2,3\). In all these cases, the polynomial system (18) proved to be incompatible.

At \(c_3=1/2\), a triangular Gröbner basis \(\{G_1,\ldots ,G_7\}\) is obtained, where \(G_1=(1-3 c_4+6 c_4^2) (-1-24 c_4+48 c_4^2) (1-32 c_4+364 c_4^2-4000 c_4^3+10288 c_4^4-8064 c_4^5-29696 c_4^6+73728 c_4^7)\). The roots of the equation \(1-3 c_4+6 c_4^2=0\) are complex. The roots of the equation \(48 c_4^2-24 c_4-1=0\) are real: \((c_4)_{1,2}=\frac{1}{12}(3\pm 2\sqrt{3})\). This case was handled above, see the schemes FR3 and FR4. The equation \(1-32 c_4+364 c_4^2-4000 c_4^3+10288 c_4^4-8064 c_4^5-29696 c_4^6+73728 c_4^7=0\) has three real roots and two pairs of complex conjugate roots. Real roots lead to three new schemes FR24, FR25, and FR26.

At \(d_3=3/4\), a triangular Gröbner basis \(\{G_1,\ldots ,G_7\}\) is also obtained. The equation \(G_1=0\) has only two real roots. The corresponding new schemes are presented in Table 6 as the schemes FR27 and FR28.

So, above we considered only 18 permutations, or 3.57 % of 5040 permutations. Therefore, it is natural that considering all 5040 permutations will allow one to obtain several further new solutions to the system (18).

The Remaining Variables as Parameters. The cases when one of seven variables \(c_2,c_3,c_4,d_1,d_2,d_3,d_4\) is declared as a parameter were handled similarly to the above-considered case of the variable \(c_1\) as a parameter, see Table 7, 8, 10, 11, 12, 13, 14, 15, and 16. Table 17 shows the number of new schemes obtained at the consideration of each of the variables \(c_i,d_i\), \(i=1,\ldots ,4\) as a parameter.

Table 18 presents the orders of smallness of the residuals \(r_{\min }\) and \(r_{\max }\) for several new symplectic schemes of the Forest–Ruth family, which were obtained above. Naturally, in cases where the analytical expressions for \(c_i\) and \(d_i\), \(i=1,\ldots ,4\) are relatively simple, it is possible to check their correctness by substituting them into the original polynomial system without switching to machine floating-point numbers. If the solution found in the analytical form is correct, then all the equations of the polynomial system are exactly satisfied. Therefore, in these cases, the equalities \(r_{\min }=0\) and \(r_{\max }=0\) take place. Formally, the schemes FR3, FR4, FR7, FR8, FR9, and FR10 are the best in terms of the smallness of the residuals \(r_{\min }\) and \(r_{\max }\). However, they are far from optimal in terms of the smallness of the functionals \(P_{5,rms}^{(l)}\) and \(X_{5,rms}^{(l)}\), see Table 19.

In other cases, numerical values of \(c_i\) and \(d_i\), \(i=1,\ldots ,4\) were substituted into the initial system in the form of machine floating-point numbers and with a mantissa length of 18 decimal digits. As can be seen from Table 18, schemes FR27, FR50, FR51, FR52, and FR73 have the smallest residuals \(r_{\min }=O(10^{-50})\) and \(r_{\max }=O(10^{-49})\). The schemes FR42, FR47, FR50, FR51, FR52, FR55, and FR59 have the least approximation errors, these are the best found schemes (see Table 19). These conclusions partially correlate with the conclusions from Table 18 concerning the schemes with the least residuals \(r_{\min }\) and \(r_{\max }\). The magnitude of the error functional \(P_{5,rms}^{(l)}\) of scheme FR10 obtained previously in [6] is 121 times larger than in the cases of new schemes FR47, FR50, FR51, and FR52.

5 Kepler’s Problem

The problem of the motion of a system consisting of two interacting particles (the problem of two bodies, the Kepler’s problem) admits a complete analytical solution in the general form [8]. This solution was presented in [14] for the case of equal masses of the both bodies, and in [15], it was given for the bodies with different masses.

Table 6. The values of the parameters of the Forest–Ruth schemes FRl (\(l=24,\ldots ,28\)) obtained in the cases when \(c_3=1/2\) or \(d_3=3/4\)
Table 7. The values of the parameters of the Forest–Ruth schemes FRl (\(l=29,\ldots ,36\)) obtained in the case when \(c_2\) is the parameter

This problem is described by a system of eight ordinary differential equations (ODEs), in which four equations describe the time evolution of the coordinates (\(x_k,y_k\)) of each of the two bodies, and the quantities (\(p_{kx},p_{ky}\)), \(k=1,2\) describe the evolution of the impulses of the bodies. The mentioned system of ODEs is solved at the given initial positions of the bodies and their impulses. With equal masses of bodies \(m_1=m_2=1\), the total initial energy \(E_0\) of both bodies \(|E_0|=|v_0^2-1/(2a_0)|\), where \(2a_0\) is the given initial distance between the bodies (\(a_0>0\)), \(v_0\) is the given absolute value of the initial velocity of each body.

Table 8. The values of the parameters of the Forest–Ruth schemes FRl (\(l=37,\ldots ,46\)) obtained in the case when \(c_2\) is the parameter

When numerically solving the Kepler problem using symplectic difference schemes, the energy \(e^n\) at \(t = t_n>0\) is calculated with an error. Let \(\delta E^n=(E^n-E_0)/E_0\), where \(E^n =(1/2)[(p_{1x}^n)^2 +(p_{1y}^n)^2+(p_{2x}^n)^2 + (p_{2y}^n)^2]-1/r^n\), \(r^n=[(x_1^n-x_2^n)^2+(y_1^n-y_2^n)^2]^{1/2}\). It was shown in [16] that for ensuring the zero eccentricity e of the particles orbits it is sufficient to set \(v_0=0.5/\sqrt{a_0}\). Along with the error in the energy \(\delta E^n\), the values of \(\delta r_{1,\max }\) and \(\delta y_{1,mean}\) were also calculated, where \(\delta r_{1,\max }=\max _j ((x_{1,j}^2+y_{1,j}^2)^{1/2}-a)/a\) for the case of the zero eccentricity. The quantity \(\delta y_{1,mean}\) was computed as the arithmetic mean of the quantities \(\delta y_{1j}=y_{1j}-y_{1,ex}\). Here \(y_{1,ex}\) is the exact value of the y coordinate at the point of the intersection of line \(x=x_{1j}\) with the ellipse of the first particle.

Table 9. The values of the parameters of the Forest–Ruth schemes FRl (\(l=47,\ldots ,53\)) obtained in the cases when \(c_4=3/4\) or \(d_1=1/2\)
Table 10. The values of the parameters of the Forest–Ruth schemes FRl (\(l=54,\ldots ,63\)) obtained in the case when \(c_3\) is the parameter
Table 11. The values of the parameters of the Forest–Ruth schemes FRl (\(l=64,\ldots ,71\)) obtained in the case when \(c_4\) is the parameter
Table 12. The values of the parameters of the Forest–Ruth schemes FRl (\(l=72,\ldots ,75\)) obtained in the case when \(c_4=1/6\) or \(c_4=16/27\)
Table 13. The values of the parameters of the Forest–Ruth schemes FRl (\(l=76,\ldots ,85\)) obtained in the case when \(d_1\) is the parameter
Table 14. The values of the parameters of the Forest–Ruth schemes FRl (\(l=86,\ldots ,90\)) obtained in the cases when \(d_1=1/3\) or \(d_2=1/6\)
Table 15. The values of the parameters of the Forest–Ruth schemes FRl (\(l=91,\ldots ,94\)) obtained in the case when \(d_2\) is the parameter
Table 16. The values of the parameters of the Forest–Ruth schemes FRl (\(l=95,\ldots ,98\)) obtained in the case when \(d_3\) is the parameter
Table 17. The number of new schemes found in the Forest–Ruth family at the consideration of each of the variables \(c_i,d_i\), \(i=1,\ldots ,4\) as a parameter
Table 18. The residuals \(r_{\min }\) and \(r_{\max }\) for several schemes from the Forest–Ruth family
Table 19. The values of the error functionals \(P_{5,rms}^{(l)}\) and \(X_{5,rms}^{(l)}\) for several schemes from the Forest–Ruth family
Table 20. Errors \(\delta E_{mean}\), \(|\delta E|_{mean}\), and \(\delta r_{1,\max }\) at \(e=0\) and \(t=7140h\), \(h=0.005\) for the fourth-order Forest–Ruth methods from Tables 12, and 9
Table 21. Errors \(\delta E_{mean}\), \(|\delta E|_{mean}\), and \(\delta y_{1,mean}\) at \(v_0=0.15\) for the fourth-order Forest–Ruth methods from Tables 1, 2, and 9

As one can see in Table 20, the symmetric Forest–Ruth scheme FR9 produces much larger errors \(|\delta E|_{mean}\) than the schemes FR3 and FR50. This is consistent with the behavior of the norm of the leading error term of these schemes.

Table 21 shows the results obtained at the nonzero eccentricity by the time \(t=500\) (\(10^5\) time steps). As in the case of the zero eccentricity, the schemes FR3 and FR50 demonstrate a higher accuracy than the scheme FR9. The error in energy \(\delta E_{mean}\) amounts in the case of the scheme FR50 to only about 1/8 of the error \(\delta E_{mean}\) obtained in the case of the scheme FR3. This means that the scheme FR50 produces a much smaller error in energy than the scheme FR3. The absolute value of the error \(\delta y_{1,mean}\) amounts in the case of the scheme FR50 to only about 1/5 of the error \(\delta y_{1,mean}\) obtained in the case of the scheme FR3. Similar errors \(\delta y_{2,mean}\) obtained for the second particle have the same absolute values as in the case of the first particle, but their signs are opposite to the signs of \(\delta y_{1,mean}\).

6 Conclusions

The problem of constructing higher-order symplectic integration techniques for molecular dynamics problems with separable Hamiltonians is considered. A general method for finding symplectic schemes of high order of accuracy using parametric Gröbner bases, resultants, and permutations of variables is proposed. The implementation of the method is described by the example of four-stage partitioned Runge–Kutta (PRK) schemes of the Forest–Ruth family. This method has enabled us to find 96 new symplectic four-stage schemes in the Forest–Ruth family. Among these schemes, several schemes have been found that are the best in terms of the smallness of the leading term of the approximation error. It turned out that the value of the error functional of the best of the two schemes obtained earlier in [6] is 121 times greater than in the case of the new best PRK schemes found in this paper.

All required symbolic calculations are performed using the computer algebra system Mathematica. When searching for new schemes, it turned out to be effective to combine the technique of Gröbner bases with Sylvester’s resultants and with permutations in the order of variables in the call of Mathematica function that calculates the Gröbner basis.

We emphasize that the real solutions of polynomial systems found using the technique described above do not exhaust the entire variety of solutions of these systems, since in this paper we focused mainly on finding solutions to the original polynomial system obtained using integer and rational roots of resultants, as well as roots of quadratic multipliers of resultants. Further solutions can be found with sufficient accuracy for applications by numerically solving the problems of minimizing the functional, which takes into account the value of one of the desired parameters, found using the resultants. This work is quite feasible and can lead to even more accurate PRK schemes compared to those schemes that were discovered in the framework of the study described above.

The presented study shows that before increasing the number of stages, it is advisable to conduct a detailed search for optimal parameters of the scheme at a fixed number of stages.