{'fraction_non_alphanumeric': 0.04780548114568308, 'fraction_numerical': 0.011436225015454358, 'mean_word_length': 3.8293532338308456, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Dynamics of the N-fold Pendulum in the framework of Lie Group Integrators

Since their introduction, Lie group integrators have become a method of choice in many application areas. Various formulations of these integrators exist, and in this work we focus on Runge--Kutta--Munthe--Kaas methods. First, we briefly introduce this class of integrators, considering some of the practical aspects of their implementation, such as adaptive time stepping. We then present some mathematical background that allows us to apply them to some families of Lagrangian mechanical systems. We conclude with an application to a nontrivial mechanical system: the N-fold 3D pendulum.


Introduction
Lie group integrators are used to simulate problems whose solution evolves on a manifold. Many approaches to Lie group integrators can be found in the literature, with several applications for mechanical systems (see, e.g. [2], [8], [9]).
The present work is motivated by applications in modelling and simulation of slender structures like beams, and the example considered here is a chain of pendulums. The dynamics of this mechanical system is described in terms of a Lie group G acting transitively on the phase space M . This setting is used to build also a numerical integrator.
In Section 2 we give a brief overview of the Runge-Kutta-Munthe-Kaas (RKMK) methods with particular focus on the variable step size methods, which we use later in subsection 4.2 for the numerical experiments.
In Section 3 we introduce some necessary mathematical background that allows us to apply RKMK methods to the system of interest. In particular, we focus on a condition that guarantees the homogeneity of the tangent bundle T Q of a manifold Q. We then consider Cartesian products of homogeneous manifolds.
In Section 4 we reframe the ODE system of the chain of N connected 3D pendulums in the geometric framework presented in Section 3. We write the equations of motion and represent them in terms of the infinitesimal generator of the transitive action. The final part shows some numerical experiments where the constant and variable step size methods are compared.

RKMK methods with variable step size
The underlying idea of RKMK methods is to express a vector field F ∈ X(M ) as F| m = ψ * ( f (m))| m , where ψ * is the infinitesimal generator of ψ, a transitive action on M , and f : M → g. This allows us to transform the problem from the manifold M to the Lie algebra g, on which we can perform a time step integration. We then map the result back to M , and repeat this up to the final integration time. More explicitly, let h n be the size of the n−th time step, we then update y n ∈ M to y n+1 by where σ 1 ≈ σ (h n ) ∈ g is computed with a Runge-Kutta method.
One approach for varying the step size is based on embedded Runge-Kutta pairs for vector spaces. This approach consists of a principal method of order p, used to propagate the numerical solution, together with some auxiliary method, of orderp < p, that is only used to obtain an estimate of the local error. This local error estimate is in turn used to derive a step size adjustment formula that attempts to keep the local error estimate approximately equal to some user-defined tolerance tol in every step. Both methods are applied to solve the ODE for σ (t) in (1), yielding two approximations σ 1 andσ 1 respectively, using the same step size h n . Now, some distance measure between σ 1 andσ 1 provides an estimate e n+1 for the size of the local truncation error. Thus, e n+1 = Chp +1 n+1 + O(hp +2 ). Aiming at e n+1 ≈ tol in every step, one may use a formula of the type where θ is typically chosen between 0.8 and 0.9. If e n > tol, the step is rejected. Hence, we can redo the step with the step size obtained by the same formula.

Mathematical background
This section introduces the mathematical background that allows us to study many mechanical systems in the framework of Lie group integrators and Lie group actions. In particular, we provide some results that we use to study the model of a chain of N 3D-pendulums presented in the last section.

The tangent bundle of some homogeneous manifolds is homogeneous
For Lagrangian mechanical systems, the phase space is usually the tangent bundle T Q of some configuration manifold Q. In [1] the authors present a setting in which the homogeneity of Q implies that of T Q. We now briefly review and reframe it in the notation used throughout the paper. Consider a smooth n−dimensional manifold Q, endowed with a transitive Ggroup action Λ : G × Q → Q. Assume that for each q ∈ Q, the map Λ q : G → Q defined as Λ q (g) := Λ(g, q), is a submersion at e ∈ G. When these hypotheses hold, it can be shown that T Q is a homogeneous manifold as well, and an explicit transitive action can be obtained from Λ. Let Λ * be the infinitesimal generator of the group action Λ, and denote withξ (q) := Λ * (ξ )(q) ∈ T q Q the differential at the identity element e ∈ G of Λ q , evaluated at ξ ∈ g. We then introduce Λ g : Q → Q, q → Λ(g, q) and call TqΛ g its tangent lift atq ∈ Q.
Consider the manifoldḠ := G g, equipped with the semi-direct product Lie group structure (see, e.g., [4]). We can introduce a transitive group action on T Q as follows: By direct computation and basic properties of Lie groups (see, e.g., [5]), it can be seen that the action ϕ is well defined. Since the action Λ is transitive on Q, we notice that ∀q ∈ Q, ∃ g ∈ G s.t. q = Λ(g, q).
Then, since Λ q is assumed to be a submersion at e ∈ G, Thus, we conclude that M = T Q is a homogeneous manifold.
In the application treated in the next section, we are interested in the case in which Q = S 2 ⊂ R 3 , i.e. the unit sphere. In this setting, a transitive group action Λ is given by Therefore, in this case we recover the restriction to T S 2 ⊂ R 6 se ( which hence becomes a particular case of a more general framework.

The Cartesian product of homogeneous manifolds is homogeneous
Consider a family of homogeneous manifolds M 1 , ..., M n . Call (G i , i ) the Lie group acting transitively on the associated smooth manifold M i , and ϕ i such a transitive action. Let g i be the Lie algebra of G i , i = 1, ..., n, and The manifold G can be naturally equipped with a Lie group structure given by the direct product. More precisely, for a pair of elements G g i = (g 1 i , ..., g n i ), i = 1, 2, we can define their product g 1 · g 2 := (g 1 1 1 g 1 2 , ..., g n 1 n g n 2 ) ∈ G. We can similarly define componentwise the exponential map.

The N-fold 3D pendulum
We now apply the geometric setting from section 3 to the specific problem of a chain of N connected 3D pendulums, whose dynamics evolves on (T S 2 ) N .

Equations of motion
Let us consider a chain of N pendulums subject to constant gravity g. The system is modeled by N rigid, massless links serially connected by spherical joints, with the first link connected to a fixed point placed at the origin of the ambient space R 3 , as in figure 1. We neglect friction and interactions among the pendulums. The modeling part comes from [7] and we omit details. We denote by q i ∈ S 2 the configuration vector of the i−th mass, m i , of the chain. Following [7], we express the Euler-Lagrange equations for our system in terms of the configuration variables (q 1 , . . . , q N ) ∈ (S 2 ) N ⊂ R 3N , and their angular velocities (ω 1 , ..., ω N ) ∈ T q 1 S 2 × ... × T q N S 2 ⊂ R 3N , defined be the following kinematic equations: The Euler-Lagrange equations of the system can be written as where R(q) ∈ R 3N×3N is a symmetric block matrix defined as and Equations (4)-(5) define the dynamics of the N-fold pendulum, and hence a vector field F ∈ X((T S 2 ) N ). We now find a function f : where ψ is defined as in subsection 3.2.
Since R(q) defines a linear invertible map (see [2]) we can rewrite the ODEs for the angular velocities as follows: In equation (6) the r i s are defined as in (5), and a 1 , ..., a N : (T S 2 ) N → R 3 can be defined as a i (q, ω) := q i × h i (q, ω). Thus, the map f is given by

Numerical experiments
In this section we show a numerical experiment with the N-fold 3D pendulum, in which we compare the performance of constant and variable step size methods. We do not show results on the preservation of the geometry (up to machine accuracy), since this is given by construction. We consider the RKMK pair coming from Dormand-Prince method (DOPRI 5(4) [3], which we denote by RKMK (5,4)). We set a tolerance of 10 −6 and solve the system with the RKMK(5,4) scheme. Fixing the number of time steps required by RKMK (5,4), we repeat the experiment with RKMK of order 5 (denoted by RKMK5). The comparison occurs at the final time T = 3 using the Euclidean norm of the ambient space R 6N . The quality of the approximation is measured against a reference solution obtained with ODE45 from MATLAB with a strict tolerance.
The motivating application behind the choice of this mechanical system has been some intuitive relation with flexible slender structures like beams. For this limiting behaviour to make sense, we first fix the length of the entire chain of pendulums to some L, then we set the size of each pendulum to L i = L/N and initialize (q i , ω i ) = (1, 0, 0, 0, 0, 0), ∀i = 1, ..., N. As we can see in figure 2a, the results of our experiments show that number of time steps that RKMK (5,4) requires to reach the desired accuracy increases with N, and this can be read in terms of an augmentation of the dynamics' complexity. For this reason, as highlighted in figure 2, distributing these time steps uniformly in the time interval [0, T ] becomes an inefficient approach, and hence a variable step size method gives better performance.