# Weakly Coupled Distributed Calculation of Lyapunov Exponents for Non-Linear Dynamical Systems
## Appendix A Pseudo-Code of the Computation Procedure  
```
Setup Initial Conditions \(x_{0}\leftarrow-0.01\) \(t_{0}\gets pi/2.0\) \(p_{0}\gets 1.57\) \(xp_{0}\gets 0.0\) \(tp_{0}\gets 0.0\) \(pp_{0}\gets 0.0\) \(t_{s}\gets 600\) \(\Delta t\gets 0.0001\) \(t_{l}\leftarrow|2*x_{0}|\) \(d_{l}\gets 0.0001\) \(n_{l}\leftarrow\text{floor}(t_{l}/d_{l})+1\) Initialize Parallel Environment (MPI) \(\text{npl}\gets n_{l}/n_{p},n_{p}\) number of processes Remainder \(\leftarrow\text{mod}(n_{l},n_{p})\) start \(\leftarrow\text{Rank}*\text{npl}+1\) end \(\leftarrow\text{Rank}+1*\text{npl}\)
```  
**Algorithm 1** Distributed Algorithm for the Calculation of Lyapunov Exponents. ```
ifremainder\(\
eq 0\)then ifRank\(<\)Remainderthen  start\(\leftarrow\)start\(+\)Rank\(\leftarrow\)end\(+(\text{Rank}+1)\) else  start\(\leftarrow\)start\(+\)Remainder  end\(\leftarrow\)end\(+\)Remainder endif ifRank\(\
eq 0\)then  start\(\leftarrow\)start\(-1\) endif \(h\gets 0\) NT\(\gets x\) while\(h<\)NTdo for\(j\leftarrow\)start,end do \(ly_{x}\gets 0.0\), \(ly_{t}\gets 0.0\), \(ly_{p}\gets 0.0\), \(ly_{xp}\gets 0.0\), \(ly_{tp}\gets 0.0\) \(rk1\gets 0.0\) \(rk1(1,0)\gets x_{0}+((j-1)*\Delta l)\) \(rk1(2,0)\gets t_{0}+((j-1)*\Delta\theta)\) \(rk1(3,0)\gets p_{0}\) \(rk1(4,0)\gets xp_{0}\) \(rk1(5,0)\gets tp_{0}\) \(rk1(6,0)\gets pp_{0}\) if\(j>1\)then for\(i\gets 1,n\)do \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) \(ly_{x}\gets ly_{x}+(1/n)*\log(|rk2(1,i-1)-rk1(1,i-1)|)/\Delta l\) endfor endif for\(l\gets 0,n\)do \(rk_{2}(0,l)\leftarrow rk1(0,l)\) \(rk_{2}(1,l)\leftarrow rk1(1,l)\) \(rk_{2}(2,l)\leftarrow rk1(2,l)\) \(rk_{2}(3,l)\leftarrow rk1(3,l)\) \(rk_{2}(4,l)\leftarrow rk1(4,l)\) \(rk_{2}(5,l)\leftarrow rk1(5,l)\) \(rk_{2}(6,l)\leftarrow rk1(6,l)\) endfor if\((\text{Rank}>0\)and\(j=\text{start})\)then \(\text{NEXT}\)\(j\) endif \(LY(0,j)\gets rk_{1}(1,0)\) \(LY(1,j)\gets ly_{x}\) \(LY(2,j)\gets ly_{t}\) \(LY(3,j)\gets ly_{p}\) \(LY(4,j)\gets ly_{xp}\) \(LY(5,j)\gets ly_{tp}\) \(LY(6,j)\gets ly_{xp}\) endfor endwhile endof Parallel Environment (MPI)
```  
**Algorithm A1**_Cont._```
procedureFX(x,t_{h},p_{h},v_{x},vt_{h},vp_{h},t,A,k,\omega,g,m_{g},m_{\theta},m_{ \phi},l_{\theta},l_{\phi},\gamma,M\)  Implements the function of the Equation (7)  Receives the values of the variables \(x,\theta,\phi,v_{x},v_{\theta},v_{\phi}\) at time \(t\),  and the parameters \(A,k,\omega,g,m_{g},m_{\phi},l_{\theta},l_{\phi},\gamma,M\) endprocedureprocedureFt(x,t_{h},p_{h},v_{x},vt_{h},vp_{h},t,A,k,\omega,g,m_{g},m_{ \theta},m_{\phi},l_{\theta},l_{\phi},\gamma,M)  Implements the function of the Equation (8)  Receives the values of the variables \(x,\theta,\phi,v_{x},v_{\theta},v_{\phi}\) at time \(t\),  and the parameters \(A,k,\omega,g,m_{\phi},m_{\phi},l_{\theta},l_{\phi},\gamma,M\) endprocedureprocedureFp(x,t_{h},p_{h},v_{x},vt_{h},vp_{h},t,A,k,\omega,g,m_{g},m_{ \phi},m_{\phi},l_{\theta},l_{\phi},\gamma,M)  Implements the function of the Equation (9)  Receives the values of the variables \(x,\theta,\phi,v_{x},v_{\theta},v_{\phi}\) at time \(t\),  and the parameters \(A,k,\omega,g,m_{g},m_{\theta},m_{\phi},l_{\theta},l_{\phi},\gamma,M\) endprocedureprocedureKK4(rk1,\(\Delta t,n\))  Runge Kutta solver  Receives the array \(rk_{1}\) that stores the result of the RK solver  at every time step, \(\Delta t\) endprocedure
```

**Algorithm A1**_Cont._

## References

* (1) [PERSON] _Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chemistry, and Engineering_; Studies in Nonlinearity; Avalon Publishing: New York, NY, USA, 2014. * (2) [PERSON] The General Problem of the Stability of Motion. Ph.D. Thesis, University of Kharkov, Kharkiv Oblast, Ukraine, 1892.