Abstract
The purpose of the present work is to construct a new Runge–Kutta pair of orders five and four to outperform the state-of-the-art in these kind of methods when addressing problems with periodic solutions. We consider the family of such pairs that the celebrated Dormand–Prince pair also belongs. The chosen family comes with coefficients that all depend on five free parameters. These latter parameters are tuned in a way to furnish a new method that performs best on a couple of oscillators. Then, we observe that this trained pair outperforms other well known methods in the relevant literature in a standard set of problems with periodic solutions. This is remarkable since no special property holds such as high phase-lag order or an extended interval of periodicity.
MSC:
65L05; 65L06; 90C26; 90C30
1. Introduction
The Initial Value Problem (IVP) is
with and the vectors . The function f is defined as
Runge–Kutta (RK) pairs are perhaps the most used numerical methods for addressing (1). They usually presented in a so-called Butcher tableau [1,2] as given below.
In this type of tableau, we have while Then, the method shares s stages and in case that A is strictly lower triangular, it is evaluated explicitly. The numerical approximations of the solution step from to by producing two numerical estimations for Namely, and , given by
and
with
for These two approximations and are of algebraic orders p and , respectively. This means that when expanding them in Taylor series, they attain orders and , respectively, with h being the proper step–length. Then, a local error estimation
is formed in every step and is combined in an algorithm for changing the steplength.
with t a small positive number which is set by the user and is named tolerance. The safety factor is in common use in such formulas and offers increased reliability to the results. Whenever , we use the above formula for defining the length of the next step forward. In reverse, when we again use it without advancing the solution in this case and using instead the value as a new trial step . Information in the issue can be found with details in [3]. As an abbreviation these methods are named RKp(q) airs.
Carl David Tolmé Runge [4] and Martin Wilhelm Kutta [5] introduced the methods bearing their names almost in the turning of the 19th century. For almost 60 years the these methods were implemented with constant step sizes. Richardson extrapolation appeared in the meantime [6] and was used in a kind of step control through doubling and halving [7]. Runge–Kutta pairs appeared 60 years ago. The first series of well-known Runge–Kutta pairs of orders 5(4), 6(5), and 8(7) were presented by Fehlberg [8,9]. In the early 1980s, Dormand and Prince gave their celebrated pairs [10,11].
Non-stiff problems having the form (1) are well suited for being efficiently solved by Runge–Kutta pairs. There is a number of different pairs sharing various orders. We may explain this by the accuracy on demand. Thus, the lesser the accuracy required, the lesser order pairs are chosen. Otherwise, for stringent accuracies at quadruple precision, a high order pair has to be preferred.
Here, we concentrate on RK5(4) pairs which are the first choice when middle tolerances are used. Our special interest is in problems of the form (1) with periodic/oscillatory solutions. In the following, we focus on producing a RK5(4) pair that best address the latter type of problems.
The paper is organized in sections as follows.
- Introduction
- Theory of Runge–Kutta pairs for orders 5(4)
- Training the coefficients
- Numerical tests
- Conclusions
2. Theory of Runge–Kutta Pairs for Orders 5(4)
Runge–Kutta pairs of orders five and four are perhaps the most used ones. The coefficients of these pairs have to satisfy 25 order conditions when the almost obligatory
holds. Namely, 17 order conditions for the higher order formula and another 8 conditions for the fourth order formula. For a seven stages (i.e., ) pair with an FSAL (First Stage As Last) property there are 28 coefficients after considering (2). Over the years, various techniques for solving this system have been presented. The solutions form different families. Dormand and Prince presented such a family and perhaps the most famous pair of all in [10]. Papakostas and Papageorgiou studied this family extensively [12]. Then, we may choose arbitrarily the coefficients and produce all the rest coefficients explicitly. The particular pair DP5(4) appeared in [10] shares small principal truncation error coefficients and it is implemented in the builtin function ode45 of MATLAB [13].
We now proceed presenting explicit formulas for the remaining coefficients that only depend on the five free parameters.
and finally the FSAL property holds
This means that although the method wastes only six stages per step and the seventh stage is reused as first stage of the next step.
The question raising now is how to choose the free parameters. Traditionally, the method developers try to minimize some norm for the principal term of the local truncation error, i.e., the terms of in the residual of Taylor error expansions corresponding to the fifth order method of the underlying RK pair. Another choice is to increase the phase-lag order. This means that we try to reduce the gap in the angle among the numerical and the theoretical solution in a free oscillator [14]. The latter approach is well suited for usage in problems with periodic solutions.
3. Training the Coefficients
We intent to derive a particular RK5(4) pair that belongs to the family discussed above. The resulting pair has to perform best on harmonic oscillators and other problems with periodic solutions. For achieving this, we will first try to find a pair that performs best on a couple of harmonic oscillators. Then, we will check if this performance expands to other problems with periodic solutions.
Thus, we concentrate on the harmonic oscillator
with theoretical solution . This problem can be transformed to a first-order system,
and then solved it numerically by a RK5(4) pair picked from the family of solutions we are concerned here. We use tolerance and and . The choice of is tailored by the numerical tests we will present below. The values selected are best placed when . Notice that the above selection of is for the training phase. It is hoped that the resulted method will furnish better results for every .
We record the number and of stages (i.e., function evaluations) needed and the global errors and observed over the grid (mesh) in the interval of integration, respectively (i.e for both selections of ). Then, we form two efficiency measures
in the sense that higher values mean lower efficiency. These measures were introduced in [15] for comparing pairs of the same order.
Now we may set as fitness function the sum which is meant to be minimized. Thus, the fitness function consists of two runs of an Initial Value Problem. The value changes according to the selection of the free parameters , and We actually do not care at this stage for , as this coefficient actually affects only the tolerance. Indeed we may choose
and set a new as the new fourth order formula. Then, the tolerance simply becomes
This idea was originally appeared in [16]. Here, for the minimization of we tried Differential Evolution [17]. We have already got positive results using this approach for methods in integrating of orbits [18,19]. In these latter works, we trained the coefficients of the methods on a Kepler orbit. Then we observed very pleasant results over a set of Kepler orbits as long on other known orbital problems.
DE is an iterative procedure and in every iteration, named generation g, we work with a “population” of individuals , with P the population size. An initial population , is randomly created in the first step of the method. We have also set as fitness function the measure obtained after two runs of harmonic oscilator. The fitness function is then evaluated for each individual in the initial population. In each generation (iteration) g, a three-phase sequential scheme updates all of the individuals involved. These phases are Differentiation, Crossover, and Selection. For further details in the issue see in [20]. We used MATLAB Software DeMat [21] for implementing the latter technique.
The optimization furnished five values for the parameters. The result is rather robust, i.e., we get almost the same optimal value for u even for neighboring parameters. Thus, we present the selected parameters in 6 significant decimal digits below,
The resulting pair is presented in Table 1.
Table 1.
Coefficients of NEW5(4) pair, accurate for double precision computations.
For the above selection of free parameters, we got
while for DP5(4) we observed
i.e.,
meaning that DP5(4) is (interpreting number ) and (interpreting number ), respectively, more expensive for delivering the same accuracy in the two oscillators chosen above.
The Euclidean norm of the principal truncation error coefficients for the new pair is which is a little smaller than the corresponding value for DP5(4). The absolute stability interval is which is rather in normal magnitude. No extra phase-lag order is observed as . See in [14] for details on phase-lag property.
In conclusion, it seems that no extra property is present. The new pair appeared in Table 1 does not possess something interesting. It is hard to believe its special performance after seeing its traditional characteristics.
Other authors have also tried recently to train coefficients of RK methods [22]. However, in that later paper, only second- and third-order methods are considered [4,5] with constant step sizes and over single problems (e.g., Van der Pol). The learning algorithm given there remains to be tested on current and stiffer cases. Our proposal for Differential evolution comes after several papers through the years [16].
4. Numerical Tests
We tested the following two pairs chosen from the family studied above.
- DP5(4) pair given in [10].
- NEW5(4) pair given here in Table 1.
DP5(4) has proven over the years to be perhaps the best pair of orders five and four. Other pairs also exist but the difference with DP5(4) is very small. We do not consider pairs that exploit the knowledge of frequency since this property is not considered here.
All the pairs were run for tolerances and the efficiency measures of the form (3) were recorded. Notice that actually all the problems are transformed in systems of first order equations.
The problems we tested are the following.
1–5. The model problem
with theoretical solution . This problem was run for five different selections of . Thus, when we use the problem is numbered as 1st problem. Then we choose and the problem is numbered as 2nd problem. In consequence when the problem is numbered as 3rd problem, when the problem is numbered as 4th problem, and when the problem is numbered as 5th problem.
6. The inhomogeneous problem
with theoretical solution .
7. The Bessel equation
The well-known Bessel equation
is verified by a theoretical solution of the form [14]
with the zeroth order Bessel function of the first kind. This equation in also integrated in the interval .
8. The Duffing equation
Next, we choose the equation
with an approximate analytical solution given in [23],
We again solved the above equation in the interval .
9. semi-Linear system.
The nonlinear problem proposed by Franco and Gomez [24] follows.
with theoretical solution
10. Van der Pol oscillator.
The equation we solved is
and no analytical solution is known. Thus, the error at grid was estimated using an eighth-order pair from [25] at tolerance .
We calculated seventy (i.e., 7 tolerances times 10 problems) efficiency measures for each pair. We set NEW54 as the reference pair. Then, we divide each efficiency measure of DP5(4) with the corresponding efficiency measure of NEW5(4). The results are recorded in Table 2. The two underlined numbers correspond to the ratios found in the phase of training above as the training was done for problems 2 and 4 and tolerance . Numbers greater than 1 are in favor of the second pair. was chosen so that the total function evaluations spend for both pairs over all 70 runs is almost equal. The rightmost column shows the mean over all tolerances for each problem. The overall average observed ratio is meaning that DP5(4) is about more expensive. This is quite remarkable since much effort has been put over the years for achieving even 10–20% of efficiency [25]. In reverse, this means that about digits were gained in average at the same costs [15].
Table 2.
Efficiency measures ratios of DP5(4) vs. NEW5(4) over the interval .
Because of the problems used for training, it is obvious that we expect better results when there is a larger linear part and a smaller nonlinear part. However, NEW5(4) outperformed DP5(4) even in the clearly nonlinear problems. We also mention that we got more or less similar results for longer integrations. Especially the results for the interval are shown in Table 3. The overall average observed is and the results slightly differ from those of the previous Table.
Table 3.
Efficiency measures ratios of DP5(4) vs. NEW5(4) over the interval .
As a final test, we included a more challenging problem which appears frequently in similar works [14,23], namely, the hyperbolic PDE,
is discretized by symmetric differences (with ) to the system of ODEs
The 500th zero of the 20th component in the above problem is reached for
which is found by a very accurate integration at stringent tolerances. We integrated the methods to that point. The results presented as stages vs. error in a semi-log form and are given in Figure 1.
Figure 1.
Results of DP5(4) vs. NEW5(4) for the Hyperbolic PDE.
The results are very promising. Some future research may use optimization on a wider range of tolerances and model problems. Perhaps a pair spending a parameter for fulfilling the phase-lag property and then trained for periodic problems would furnish even more interesting results. Of course, application of this technique on other classes of problems is also possible, e.g., orbits.
5. Conclusions
We proposed the proper training the coefficients of Runge–Kutta pairs of orders five and four in order to perform best on problems with oscillatory solutions. We actually chose a couple of harmonic oscillators, an interval and a tolerance and tried to achieve an outstanding performance there. Thus, we concluded to a new pair which is found to outperform other representatives from this family in a wide range of relevant problems. This pair is supposed to be better than classical DP5(4) for problems with periodic solutions. If there are limitations remain to be clarified by applications in the future research.
Author Contributions
All authors have contributed equally. All authors have read and agreed to the published version of the manuscript.
Funding
The research was supported by a Mega Grant from the Government of the Russian Federation within the framework of the federal project No. 075-15-2021-584.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Butcher, J.C. On Runge-Kutta processes of high order. J. Austral. Math. Soc. 1964, 4, 179–194. [Google Scholar] [CrossRef] [Green Version]
- Butcher, J.C. Numerical Methods for Ordinary Differential Equations; John Wiley & Sons: Chichester, UK, 2003. [Google Scholar]
- Shampine, L.F.; Watts, H.A. The Art of Writing a runge-kutta Cosde. II. Appl. Math. Comput. 1979, 5, 93–121. [Google Scholar]
- Runge, C. Ueber die numerische Auflöung von Differentialgleichungen. Math. Ann. 1895, 46, 167–178. [Google Scholar] [CrossRef] [Green Version]
- Kutta, W. Beitrag zur naherungsweisen Integration von Differentialgleichungen. Z. Math. Phys. 1901, 46, 435–453. [Google Scholar]
- Richardson, L.F. The deferred approach to the limit. Part I.—Single lattice. Philos. Trans. R. Soc. Lond. Ser. A 1927, 226, 299–349. [Google Scholar]
- Shampine, L.F. Local Error Estimation by Doubling. Computing 1985, 34, 179–190. [Google Scholar] [CrossRef]
- Fehlberg, E. Klassische Runge-Kutta-Formeln fiinfter und siebenter 0rdnung mit Schrittweiten-Kontrolle. Computing 1969, 4, 93–106. [Google Scholar] [CrossRef]
- Fehlberg, E. Klassische Runge-Kutta-Formeln vierter und niedrigererrdnung mit Schrittweiten-Kontrolle und ihre Anwendung auf Warmeleitungsprobleme. Computing 1970, 6, 61–71. [Google Scholar] [CrossRef]
- Dormand, J.R.; Prince, P.J. A family of embedded Runge-Kutta formulae. J. Comput. Appl. Math. 1980, 6, 19–26. [Google Scholar] [CrossRef] [Green Version]
- Prince, P.J.; Dormand, J.R. High order embedded Runge-Kutta formulae. J. Comput. Appl. Math. 1981, 7, 67–75. [Google Scholar] [CrossRef] [Green Version]
- Papakostas, S.N.; Papageorgiou, G. A family of fifth order Runge-Kutta pairs. Math. Comput. 1996, 65, 1165–1181. [Google Scholar] [CrossRef] [Green Version]
- Shampine, L.F.; Reichelt, M.W. The MATLAB ODE Suite. SIAM J. Sci. Comput. 1997, 18, 1–22. [Google Scholar] [CrossRef] [Green Version]
- Papageorgiou, G.; Tsitouras, C.; Papakostas, S.N. Runge-Kutta pairs for periodic initial value problems. Computing 1993, 51, 151–163. [Google Scholar] [CrossRef]
- Shampine, L.F. Some practical Runge-Kutta formulas. Math. Comput. 1986, 46, 135–150. [Google Scholar] [CrossRef]
- Tsitouras, C. Neural Networks With Multidimensional Transfer Functions. IEEE Trans. Neural Netw. 2002, 13, 222–228. [Google Scholar] [CrossRef]
- Storn, R.; Price, K. Differential evolution—A simple and efficient heuristic for global optimization over continuous spaces. J. Glob. Optim. 1997, 11, 341–359. [Google Scholar] [CrossRef]
- Tsitouras, C.; Famelis, I.T. Using neural networks for the derivation of Runge–Kutta–Nyström pairs for integration of orbits. New Astron. 2012, 17, 469–473. [Google Scholar] [CrossRef]
- Shen, Y.C.; Lin, C.L.; Simos, T.E.; Tsitouras, C. Runge–Kutta Pairs of Orders 6 (5) with Coefficients Trained to Perform Best on Classical Orbits. Mathematics 2021, 9, 1342. [Google Scholar] [CrossRef]
- Famelis, I.T.; Alexandridis, A.; Tsitouras, C. High Accuracy Hybrid DE-PSO Algorithm for the construction of Runge–Kutta pairs. Enginr. Optim. 2017, 50, 1364–1379. [Google Scholar]
- DeMat. Available online: https://www.swmath.org/software/24853 (accessed on 23 August 2021).
- Guo, Y.; Dietrich, F.; Bertalan, T.; Doncevic, D.T.; Dahmen, M.; Kevrekidis, I.G. Personalized Algorithm Generation: A Case Study in Meta-Learning ODE Integrators. arXiv 2021, arXiv:2105.01303v1. [Google Scholar]
- Simos, T.E.; Tsitouras, C.; Famelis, I.T. Explicit Numerov Type Methods with Constant Coefficients: A Review. Appl. Comput. Math. 2017, 16, 89–113. [Google Scholar]
- Franco, J.M.; Gomez, I. Trigonometrically fitted nonlinear two-step methods for solving second order oscillatory IVPs. Appl. Math. Comput. 2014, 232, 643–657. [Google Scholar] [CrossRef]
- Papakostas, S.N.; Tsitouras, C. High phase-lag order Runge-Kutta and Nyström pairs. SIAM J. Sci. Comput. 1999, 21, 747–763. [Google Scholar] [CrossRef]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).