The fastest, simplified method of Lyapunov exponents spectrum estimation for continuous-time dynamical systems

Classical method of Lyapunov exponents spectrum estimation for a n-th-order continuous-time, smooth dynamical system involves Gram–Schmidt orthonormalization and calculations of perturbations lengths logarithms. In this paper, we have shown that using a new, simplified method, it is possible to estimate full spectrum of n Lyapunov exponents by integration of (n-1)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n-1)$$\end{document} perturbations only. In particular, it is enough to integrate just one perturbation to obtain two largest Lyapunov exponents, which enables to search for hyperchaos. Moreover, in the presented algorithm, only very basic mathematical operations such as summation, multiplication or division are applied, which boost the efficiency of computations. All these features together make the new method faster than any other known by the authors if the order of the system under consideration is low. Correctness the method has been tested for three examples: Lorenz system, Duffing oscillator and three Duffing oscillators coupled in the ring scheme. Moreover, efficiency of the method has been confirmed by two practical tests. It has been revealed that for low-order systems, the presented method is faster than any other known by authors.


Introduction
Depending on a dynamical system type and a kind of information that is useful for its investigations, different types of invariants characterizing system dynamics are applied. For instance, one may use Kolmogorov entropy [1,2], correlation dimension [3,4], Lyapunov energy function [5] to determine the stability of solutions and complexity of system dynamics [6]. However, in order to predict the influence of perturbations on solution of a system, Lyapunov exponents (LEs) are one of the most commonly applied tools. That is because these exponents determine the exponential convergence or divergence of trajectories that start close to each other. The existence of such numbers has been proved by Oseledec theorem [7], but the first numerical study of the system's behavior using Lyapunov exponents had been done by Henon and Heiles [8], before the Oseledec theorem publication. The most important algorithms for calculating Lyapunov exponents for continuous systems have been developed by Benettin et al. [9] and Shimada and Nagashima [10], later improved by Benettin et al. [11] and Wolf [12]. In order to estimate Lyapunov exponents from a scalar time series, the Takens procedure [13] can be applied. This approach can be utilized also in the cases when discontinuities or time delays exist in the analyzed system. Numerical algorithms for such estimation have been developed by Wolf et al. [14], Sano and Sawada [15] and later improved by Eckmann et al. [16], Rosenstein et al. [17] and Parlitz [18]. Alternative method appli-cable to systems with discontinuities or time delays, based on synchronization phenomena, was elaborated by Stefanski [19][20][21][22].
Thus, there is still need to elaborate fast and simple methods of LE calculation. Recently, we have presented our simple and effective method of estimation of the largest Lyapunov exponent (LLE) from the perturbation vector and its derivative dot product. The method is based on a clear, geometrical reasoning. Its application involve only basic mathematical operations such as summing, multiplying, dividing. The method can be applied in different aspects of the nonlinear systems control. We investigated continuous systems [42], synchronization phenomena detection [43], time series in control systems [44][45][46].
The method presented previously was limited to calculation of the Largest Lyapunov exponent. In this paper, we have revealed that it is possible to apply it for estimation of the whole Lyapunov exponents spectrum too. Moreover, it has been shown that special features of the presented method enable to estimate the whole spectrum of n Lyapunov exponents by integration of (n − 1) perturbations only. The algorithm has been tested for three examples: Lorenz system, Duffing oscillator and three Duffing oscillators coupled in the ring scheme. Selection of the exemplary systems can be justified by the fact that they exhibit different types of dynamical behavior depending on the analyzed parameters. Therefore, correctness of the method has been confirmed for periodic, quasiperiodic and chaotic trajectories [47]. Computation times and convergence rates have been compared with the classical method [47] that involves Gram-Schmidt orthonormalization and calculations of perturbations lengths logarithms. The method presented in [47] uses the same approach as algorithms described in [9,11]. To authors' best knowledge, no algorithms of LE spectrum estimation for continuous-time, smooth dynamical systems faster than [9][10][11]47] have been published. In this paper, it has been revealed that application of our new algorithm increases the efficiency of the calculations compared to the classical method [47] when the order of the system is low: 2, 4 or 6. Such acceleration has been achieved not only due to integration of (n − 1) perturbations instead of n, but also owing to the simplicity of the algorithm, which involves only the basic mathematical operations: addition, multiplication, division. Compared to the classical method, calculation of logarithms and normalization of perturbations after each iteration can be omitted. Therefore, authors claim that the method presented in this paper is the fastest one in the assumed range of applications if the order of the system is low enough.

The method
Assume that a dynamical system is described by the set of differential equations in the form: where x is the state vector, t is the time and f is a vector field that (in general) depends on x and t. Evolution of any perturbation z in such system can be found from the equation: where U (x, t) is the Jacobi matrix obtained by differentiation of f with respect to x. As it has been shown in the previous paper [42], the value of LLE can be estimated from the following expression: where z 1 is a perturbation vector, whose evolution can be obtained by numerical integration of Eq. (2). The approximate value of LLE (λ 1 ) is obtained by averaging values of λ * 1 from subsequent computation steps. For time of integration long enough, the average value of λ * 1 converges to the LLE. Please note that formula (3) involves only the most basic mathematical operations-addition, multiplication and division. On According to [47], each LE λ i is the average rate of perturbation contraction or expansion in a particular subspace near a particular limit set. The LLEλ 1 -is the average rate of perturbation length change in (almost) whole space in which system (1) is defined. Let this whole space be named W 1 .
For a system of order n, there are n nested subspaces: such that the dimension of subspace W i is n + 1 − i. In each subspace W i , a perturbation evolves, on the average, according to λ i . Therefore, i-th LE can be obtained from evolution of a perturbation in the subspace W i . The classical method of LE spectrum estimation involves Gram-Schmidt orthonormalization and calculations of perturbations lengths logarithms [47]. In this approach, n perturbations z 1 , z 2 , . . . , z n are integrated. Orthonormalization procedure assures that each perturbation z i evolves in the subspace W i . Values of LE are obtained by calculating natural logarithm of perturbations lengths after subsequent integration steps and averaging these values over time. The crucial fact is that in order to calculate whole spectrum of n LE, integration of n perturbations is necessary.
In the presented method, complexity of calculations is reduced. In order to estimate the whole spectrum of n LE, it is enough to integrate (n − 1) perturbations. For clarity, in the next paragraph, the case of a secondorder system is discussed. Authors demonstrate how integration of only one perturbation z 1 enables to estimate both LE: λ 1 , λ 2 . The subsequent paragraph covers the general case, i.e., estimation of a full LE spectrum of a nth-order system using only (n − 1) integrated perturbations.
Let us assume that for a 2nd-order system, only one perturbation z 1 is integrated. Obviously, using formula (3), LLE can be calculated. As z 1 evolves according to (2), it tends to line up with the direction in which evolution of the perturbation is governed mainly by the value of λ 1 , whereas the terms connected with λ 2 become negligible [47]. Therefore, throughout its evolution, z 1 tends to a direction orthogonal to W 2 . Let us also take any random vector z 2 , the length of which is nonzero and which is not parallel to z 1 (Fig. 1).
Using the orthogonalization formula [47]: one obtains a vectorz 2 which is perpendicular to z 1 . Therefore, to a good approximation,z 2 ∈ W 2 . Notice that for a 2nd-order system, W 2 is simply a line in W 1 space. Thus,z 2 must have the direction of a perturbation in W 2 subspace, despite the fact thatz 2 has no connection with system (1) and the vector z 2 was selected randomly. Moreover, it can be easily checked that the length of a perturbation does not affect the value obtained from formula (2). Summing up, one can use formula (2) to find the 2nd LE. It is only needed to use the vectorz 2 which lies in W 2 instead of z 1 . The second LE can be found from the following expression: The approximate value of λ 2 is obtained by averaging values of λ * 2 from subsequent computation steps. For long enough time of integration, the average value of λ * 2 converges to the 2nd LE. Consequently, one does not need to integrate the 2nd perturbation; it is enough to find a correct direction of the vectorz 2 .
Let us now consider a system of order n. Suppose that (n − 1) perturbations z 1 , z 2 , . . . , z n−1 are integrated 1 . Their time derivatives can be found from formula (2). As z 1 evolves, it tends to line up with the direction in which evolution of the perturbation is governed mainly by the value of λ 1 , whereas the terms connected with subsequent LE λ 2 , λ 3 , . . . , λ n become negligible [47]. Therefore, throughout its evolution, z 1 tends to a direction orthogonal to W 2 . The component z 2 of the perturbation z 2 , which is perpendicular to z 1 , can be obtained by means of formula (5). To a good approximationz 2 ∈ W 2 . Moreover,z 2 tends to a direction which is orthogonal to W 3 . Consequently, vectors z 3 ,z 4 , . . . ,z n−1 can be calculated using the following orthogonalization expression: Formula (7) yields a vectorz k which has no components in directions of z 1 ,z 2 , . . . ,z k−1 . Each of the vectorsz k , estimated by means of (7), approximately fulfills the conditionz k ∈ W k and tends to a direction orthogonal to W k+1 . Therefore, the LE λ 2 , λ 3 , . . . , λ n−1 can be estimated from the formula: The approximate value of λ k is obtained by averaging values of λ * k from subsequent computation steps. For long enough time of integration, the average value of λ * k converges to the kth LE. Now, let us take any random vector z n such that its length is nonzero and it is linearly independent from z 1 ,z 2 , . . . ,z n−1 . Using formula (7), one can orthogonalize the random vector z n with respect to z 1 ,z 2 , . . . ,z n−1 . In such a manner,z n is obtained. The length ofz n is random, but owing to the orthogonalization process, it approximately fulfills the conditionz n ∈ W n . Note that the order of the subspace W n is equal to 1, so W n is simply a line in the W 1 space. Therefore,z n must have the direction of a perturbation in the W n space. Moreover, the value obtained from formula (8) is independent from the length ofz k . Concluding, one can apply formula (7) to orthogonalize a randomly selected random vector z n with respect to the integrated perturbations z 1 ,z 2 , . . . ,z n−1 and then use the resultz n to estimate the last LE by means of formula (8). In such a manner, it has been shown that it is enough to integrate (n − 1) perturbations to estimate the full spectrum of LE of a nth-order system.

Numerical simulations
Simulation programs were written in C++ using Code-Blocks 16.01. Graphs and diagrams were built with matplotlib library as a tool of Python programming language. In order to integrate the system of differential Eqs. (1)-(2), Runge-Kutta method of the fourth order was used. The integration step was chosen experimentally for each system. In order to estimate the whole spectrum of Lyapunov exponents, the method requires to simulate (n − 1) perturbations, where n is the order of the system. For example, for the second-order non-autonomous Duffing oscillator with external excitation [42], one perturbation was calculated. For the third-order autonomous system of Lorenz equations [48], two disturbances were observed. For three Duffing systems coupled in a ring scheme [50], which together constitute a system of the 6th order, five perturbations were integrated. After each integration step, subsequent perturbations were normalized and orthogonalized according to Eqs. (5), (7).
After every integration step, values λ * i are calculated for each perturbation. For the value of λ * 1 , formula (3) is used; for λ * 2 , λ * 3 , . . . , λ * n , formula (8). The simulation program remembered subsequent values of λ * i in n buffers of a fixed capacity. When buffers were full, the program calculated standard deviation of all the values in each of n buffers. If the standard deviation of values in any buffer was too high, buffers were cleared and computations were continued. Otherwise, if the value of standard deviation for each buffer was below a fixed threshold, the calculations were terminated. The final value of λ i returned by the program was equal to the average of all values λ * i remembered in the i-th buffer.

Results of numerical simulations
In order to verify our method of the Lyapunov exponents spectrum estimation, three systems have been analyzed: Lorenz equations, Duffing oscillator with external periodic driving forcing and three Duffing systems coupled in a ring scheme. Firstly, the Lorenz system can be described with the following mathematical model [49]: Jacobi matrix was used to simulate evolution of perturbations according to Eq. (2). For the Lorenz system (9), the Jacobi matrix is described by formula (10).
System (9) is nonlinear and autonomous. The spectrum of Lyapunov exponents of the system was computed with two parameters fixed, σ = 10, β = 8/3, while r was used as the control parameter in the range from 0 to 100. Initial conditions for r = 0 were set as a random three-element vector of magnitude 1. Initial perturbations were also chosen randomly and normalized to 1. The bifurcation diagram of the state variable z in system (9) is shown in Fig. 2. The corresponding graph of LE spectrum calculated using the new method is depicted in Fig. 3, whereas the LE spectrum graph obtained by means of the classical method is shown in Fig. 4.
The bifurcation diagram presented in Fig. 2, together with the LE diagram presented in Figs. 3, 4, demonstrates that the Lorenz system (9) is periodic for all the values of r smaller or equal to 24.7, whereas it is chaotic for most values of r larger or equal to 24.8. However, for some values of r above 24.8, periodic windows exist. Detailed information on different kinds of limit sets in dynamical systems can be found in [47]. It can be noticed that the graphs in Fig. 3 (the new method) and in Fig. 4 (the classical method) are in complete agreement. Moreover, both graphs are consistent with [48], which confirms the correctness of the algorithm presented in this paper.
The Duffing oscillator can be described by the following mathematical model [42]: The linear stiffness in Eq. (11) was skipped as in [42], which enables to compare the results. Jacobi matrix was  (9), calculated using the classical method used to simulate evolution of perturbations according to Eq. (2). For the Duffing system (11), the Jacobi matrix is described by formula (12).
The spectrum of Lyapunov exponents for the Duffing oscillator was computed with such fixed parameters as β = 0.05, α = 1, η = 0.5. Parameter q was used as the control parameter in the range from 0.5 to 1.8 [42]. In the simulation, a random vector of length 1 was used as initial condition. Initial perturbations were also random and normalized to 1. The bifurcation diagram of the state variable x of the Duffing Eq. (11) is shown in Fig. 5. The corresponding graph of LE spectrum calculated using the new method is depicted in Fig. 6. The LE spectrum graph obtained by the classical method is presented in Fig. 7. In both cases, red line corresponds to the largest LE, while blue line corresponds to the second Lyapunov exponent of system (11). Figures 5, 6 and 7 show that the Duffing system is chaotic for most values of the parameter q in ranges from 0.693 to 0.738 and from 1.237 to 1.673. However, some periodic windows exist in these ranges too.
For the values of r between 0.5 and 0.692, from 0.739 to 1.236 and from 1.674 to 1.8, the system is periodic. For the Duffing system, the generalized divergence of the flow is constant and equal to −β [49]. Sum of Lyapunov exponents has to be equal to the generalized divergence of the flow. Therefore, graphs of the first and second Lyapunov exponents should be symmetri-    Fig. 6 and in Fig. 7.
Next, we consider a ring of three Duffing systems [50]. The resulting system is given by: where i = 1, 2, 3 and p (i) is the index of the previous oscillator in the ring, i.e., p (3) = 2, p (2) = 1, p (1) = 3. Jacobi matrix of system (13) is described by formula (14): where u i = −a −3x 2 i −k. System (13) is nonlinear and autonomous. The spectrum of Lyapunov exponents of the system was computed with two parameters fixed, d = 0.3, a = 0.1, while the coupling coefficient k was used as the control parameter in the range from 0 to 4. Initial conditions for k = 0 were set as a random six-element vector of magnitude 1. Initial perturbations were also chosen randomly and normalized to 1. Please note that names of parameters are different in formulas (11) and (13). This is due to the fact that results of both simulations can be verified in two different sources. Results of calculations for system (11) can be checked in [42], whereas system (13) can be verified in [50].
The bifurcation diagram of the state variable x 3 in system (13) is depicted in Fig. 8. The corresponding graph of LE spectrum calculated using the new method is shown in Fig. 9. The LE spectrum graph obtained by the classical method is presented in Fig. 10.  (13) changes as the coupling strength increases [50]. For the values of k smaller than 0.24, one can notice that all the LEs are negative and the system tends to a stable fixed point. For the values of k between 0.24 and 0.38, one LE is equal to 0, which corresponds to a periodic solution. In the range of parameter k from 0.38 to 1.79, more than one LEs are zero and a quasiperiodic solution is obtained. Transition to chaos takes place for k equal to 1.79, followed by transition to hyperchaos as coupling coefficient reaches 1.9. Please note that the full spectrum of six LEs was obtained by integration of five perturbation vectors. However, if the task is to just detect chaos and hyperchaos, only one perturbation is necessary when our new method is applied, whereas integration of two perturbations is required if the classical method is used.

Computation time comparisons
In the previous sections, the novel method has been explained and results of its application have been demonstrated. It has been confirmed that the novel method requires integration of only (n − 1) perturbations to estimate n Lyapunov exponents, which is expected to increase efficiency of calculations. Moreover, formulae (3) and (8), which are used for LE estimation in the new method, require only the most basic mathematical calculations-addition, multiplication and division. In such a manner, calculation of perturbation's norm logarithm, which is necessary in the classical method, can be avoided. Therefore, there are two possible reasons for efficiency of the novel method. Firstly, size of the problem is reduced, because only (n − 1) perturbations are integrated. However, computation speed gain due to this feature may vary with the order of the system. Secondly, application of formulae (3) and (8) instead of estimation of the logarithm of the perturbation norm can additionally shorten the computation time.
Firstly, influence of application of formulae (3) and (8) is analyzed without taking into account the number of perturbations to be integrated. When the classical method of LE estimation is applied, each computation step requires to calculate the norm of a perturbation. The norm can be treated as the square root of the dot product of the perturbation vector with itself. Then, the natural logarithm of the norm is calculated. On the other hand, formulae (3) and (8) of the new method require not only the perturbation vector, but also its time derivative. When both vectors are known, then according to (3) and (8), the dot product of the perturbation and its time derivative is divided by the dot product of the perturbation vector with itself.
Efficiency of both approaches has been tested by a C++ program. The program selects 2 * 10 7 vectors at random. Then, it checks how much time it takes to estimate natural logarithm of the norm of each of these vectors, just as it is done in the classical method of LE estimation [47]. Afterward, formula (3) is applied for each vector from the same set and time of these operations is also measured. In such a manner, efficiency of both methods of LE estimation can be compared. This test has been executed 100 times for different vector dimensions. The average, the minimum and the max- However, an important issue arises: Efficiency of the novel method of LE estimation can be largely influenced by estimation of the perturbation's derivative, which is required by the new method. If the Jacobi matrix U (x) contains only few nonzero elements, then calculation of the perturbation's derivative according to formula (2) is fast. When most elements of U (x) are nonzero, then calculation of the perturbation's derivative is slower. Therefore, two separate cases have been analyzed. In the best scenario, only one element in each row of U (x) is nonzero. In the worst case, all elements of U (x) are nonzero. Results for both cases with different vector dimensions are presented in Figs. 11 and 12. These figures represent the best case and the worst case, respectively. In each of these graphs, the computation time ratio is obtained by dividing computation time of formula (3) by the average time of calculations with the classical method, i.e., when the natural logarithm of the vector's norm is estimated. Therefore, value 1 in the graph means that the computation time for both methods is equal. Values below 1 show that the new method is faster, and values above 1 indicate that the novel method is slower. Figures 11 and 12 show that when order of the system is less or equal to 4, then evaluation of formula (3) or (8) is always faster than calculation of the natural logarithm of the perturbation's norm. However, for higher order systems, evaluation of the perturbation's norm logarithm can be faster if the Jacobi matrix U (x) is dense enough. On the other hand, if U (x) is sparse, then evaluation of formula (3) or (8) is faster than the classical formula for all vector dimensions under consideration. Now, as the influence of using the simplified formulae (3) and (8) has been investigated, overall efficiency of the novel method can be checked on a practical example. To do so, the spectrum of Lyapunov exponents of Duffing systems coupled in ring scheme (13) has been estimated with both methods for different number of oscillators in the ring, from 1 to 5. Therefore, systems of orders 2, 4, . . . , 10 have been investigated. The same coupling strength k = 3.0 has been used in all tests. For each number of oscillators, the Lyapunov exponents spectrum has been estimated 100 times using both methods. The orthonormalization process [47] has been performed after each iteration of both methods. The average, minimum and maximum computations times have been recorded. The results are presented in Fig. 13. The computation time ratio is obtained by dividing the calculations time of the novel method by the average time of calculations of the classical method. Therefore, just as in previous graphs, values below 1 indicate that the novel method is faster, whereas values above 1 show that the classical method performs better. Figure 13 confirms that the novel method, presented in this paper, is faster than the classical method [47] in each test case, as long as order of system (13) is smaller or equal to 4. For the system with three oscillators and order 6, the novel method is faster in the average, but it is not faster in each trial. When more than three oscillators are coupled together, the classical method performs better.

Conclusions
The presented article shows that from dot products of perturbations vectors and their derivatives, one can easily extract the full spectrum of Lyapunov exponents. We have shown that full spectrum of LE for a system of order n can be obtained by integrating only (n − 1) perturbations. Moreover, due to the fact that our method is based on very unsophisticated computations involving only basic mathematical operations such as summing, subtracting, multiplying, dividing, it is more efficient than the classical one when the order of the system is low enough. We have presented the theoretical description showing the mathematical simplicity of the method. The correctness and effectiveness of our method has been confirmed by simulations of autonomous and non-autonomous nonlinear dynamical systems of different orders. These results have been compared with the ones obtained using the classical algorithm. The efficiency of the new method has been compared to the method that involves the calculation of perturbations lengths logarithms and Gram-Schmidt orthonormalization. Firstly, it has been shown that application of the new, simple formulas for LE estimation is faster than calculation of the natural logarithm of perturbation's norm for systems of dimension smaller or equal to 4, even if the Jacobi matrix of the system is dense. It has been revealed that if the Jacobi matrix is sparse, then the novel formulas can perform better even for systems of the dimension 10 or higher. Secondly, efficiency of the novel method has been verified for Duffing systems coupled in the ring scheme. It turned out that the novel method is in average faster if the dimension of the system is smaller or equal to 6. Obviously, efficiency of both methods may vary depending on properties of the system under consideration. Moreover, implementation of the method may influence the effectiveness. However, taking into account the obtained results, it can be stated that for low-dimensional, continuous-time, smooth systems, the presented method of LE spectrum estimation is the fastest one. The next step of the method's develop-ment can be considered in estimation of LE in systems with discontinuities, with time delays and others.