The symbolic problems associated with Runge–Kutta methods and their solving in Sage

Runge–Kutta schemes play a very important role in solving ordinary differential equations numerically. At first we want to present the Sage routine for calculation of Butcher matrix, we call it an rk package. We tested our Sage routine in several numerical experiments with standard and symplectic schemes and verified our result by corporation with results of the calculations made by hand. Second, in Sage there are the excellent tools for investigation of algebraic sets, based on Gröbner basis technique. As we all known, the choice of parameters in Runge– Kutta scheme is free. By the help of these tools we study the algebraic properties of the manifolds in affine space, coordinates of whose are Butcher coefficients in Runge–Kutta scheme. Results are given both for explicit Runge–Kutta scheme and implicit Runge–Kutta scheme by using our rk package. Examples are carried out to justify our results. All calculation are executed in the computer algebra system Sage.


Introduction
The Runge-Kutta method is the most popular numerical method for solving of ordinary differential equations (ODE), however the development of this method indicates some symbolic problems.
Let's review some results on Runge-Kutta scheme [1]. For an autonomous system˙ x = F ( x) (1) Runge-Kutta scheme with s stages can be written as We will write the coefficients a ij and b i in Butcher matrix, for example, for s = 2 Hereinafter c i = s j=1 a ij .
These coefficients are selected in such a way that the difference scheme approximates the ODE (1) with some order p. For s = p = 4 appropriate numerical values for the coefficients was found by Kutta in the XIX century. The usage of Runge-Kutta scheme for the solving of given ODEs means the numerical calculations in the floating-point arithmetic.
However the problem about finding the coefficients of Butcher matrix is pure algebraic, so now we can try to solve it with the help of computer algebra systems like Sage or Maple [2][3][4]. This is the first symbolic problem associated with Runge-Kutta method. In our paper we want to present our algorithms for symbolical calculation of the Butcher matrix and its realization in Sage.
It should be noted that conditions of approximation and other conditions don't define the coefficients of Butcher matrix unambiguously. From geometrical point of view the list of coefficients of Butcher matrix is a point in affine space (Butcher space) and appropriate points form a variety in this space. As in Sage there are some tools for a research of a set of solutions of systems of the algebraic equations, we can try to describe the varieties in Butcher spaces.
The Runge-Kutta scheme is explicit iff a ij = 0, j i, in this case the numerical calculation doesn't demand the solving of nonlinear algebraic equations. This is the most investigated case, for small s the Butcher varieties ware described by Butcher himself, now we know approximate values of a ij for schemes with s = 9 [5][6][7].
The implicit Runge-Kutta scheme is interesting because they can save some symbolic properties of exact solution. By Cooper theorem symplectic Runge-Kutta scheme saves exactly all quadratic integrals of motion [8,9]. The symplecticity gives algebraic conditions for Butcher matrix, and we can try to investigate the varieties in Butcher space by the help of Sage.
In our numerical experiments these varieties were rational with singularity at point with a ij = 0 at all values of i and j. Thus there are infinite set of Butcher matrices with rational coefficients.
Organization of calculations by the implicit Runge-Kutta scheme demands solving of algebraic equations at each step. Investigation of the algebraic system is the second symbolic problem associated with Runge-Kutta scheme which we can try to solve by Sage.

The problem of finding coefficients of Butcher matrix, approximative conditions
In this part, we try to set up a program for finding Runge-Kutta scheme when s is number of the stages and p is order of approximation. This scheme we can call rk(s,p). Butcher matrix is square matrix of degree s. Condition of approximation is algebraic equation with respect of elements of Butcher matrix. Firstly, we note that these equations don't depend on the number of the approximative differential equations, so we can only consider the first order equationẋ = f (x).
The Taylor series for the solution satisfying the zero initial condition At t = t 1 we have where dt = t 1 − t 0 . The first step of Runge-Kutta scheme with s stages can be written as Let the power series for the solution of systems (5) be Manually or in computer algebra system we can find their coefficients by recursion. So at dt = 0 the equations (5) give us To find the coefficients at dt, we differentiate the equations (5) with respect to dt and substitute dt = 0, then we have a ij k j,0 , i = 1, 2, . . . , s. To find the coefficients of dt 2 , we differentiate the equations (5) twice and substitute dt = 0 again, etc. Substituting the power series for k i in (6) we have the power series forx. By definition, the difference scheme has the p-th order approximation, if first p terms of the power series (4) for exact solution at t = t 1 and the power series forx coincide. So, these are the required conditions of approximation written as a system of algebraic equations with respect to Butcher coefficients.
We try investigate rk (4,4) in Sage. Our program give system of equations very quickly but Sage can't calculate Gröbner basis of the ideal, generated by this system. We try use CAS Maple (which have several commercial routines for calculation Gröbner basis) but without success. It should be noted that this system was investigated by hand in the XIX century! By using Sage we calculate the dimensions of the algebraic sets for explicit and implicit RK-schemes. Results are presented in the Tables 1 and 2. The analysis of RK-schemes with bigger p cannot be made in such a way that the Gröbner basis can be calculated.  Table 1 Dimensions for implicit Runge-Kutta scheme in the case of 1 < s < 4; 1 < p < 4 s, p p = 2 p = 3 s = 2 4 2 s = 3 10 8 Table 2 Dimensions for explicit Runge-Kutta scheme on the case of 1 < s < 4; 1 < p < 4. The value −1 means that the set of Runge-Kutta scheme with given s and p is empty
In our numerical experiments the variate S(s, p) with maximal value of p at fixed value of s has the dimension 1 and the genus 0 and thus is a rational curve in Butcher space. In practice it is important that there is an infinite number of sets of rational values for Butcher coefficients.

Conclusion
In this article we investigated one of the symbolic problems associated with Runge-Kutta method, namely the problem of calculation of Butcher matrix. We tested our Sage routine in several numerical experiments and verified our results by comparing them with the results of calculations made by hand.
We saw that computer algebra systems was ready to solve this problem and gave us some tools for investigation of the set of Butcher matrices. These tools indicate in our numerical experiments that Butcher coefficients were rational functions of one or two parameters and thus there is an infinite number of sets of rational values for Butcher coefficients. Perhaps, this property can be proved for Runge-Kutta schemes with any number of stages. This question requires further study. Also we can't calculate Gröbner basis of the ideals generated at s > 3. Perhaps, a successful substitution can solve this issue.