1 Introduction

The kinematics and dynamics of rigid bodies constitute an important part of the simulation of multibody system. Many kinds of coordinates can be used to represent the rotational motion of a rigid body, such as Euler angles and unit quaternions [1]. As a non-minimal representation, the unit quaternion has found new attraction in recent years because of its simplicity in the mathematical formulation and the ability to avoid the singularity which may occur when using Euler angles.

A unit quaternion describes the three-dimensional rotational motion using four real parameters, with a unit length constraint, which essentially extends the motion equations by a holonomic constraint and yields a set of differential-algebraic equations (DAEs) of Index 3, instead of ordinary differential equations (ODEs). In 1980s, the unit quaternion was investigated in detail by Nikravesh and Haug et al. [2,3,4,5] for the dynamic analysis of a three-dimensional constrained mechanical system. Later, the quaternion-based rigid body dynamics was developed rapidly owing to many theoretical researches and applications about unit quaternions [6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]. Some of these researches focused on various equivalent formulations for rotational motion in the Lagrangian or Hamiltonian framework [6,7,8,9,10,11,12,13,14], and the others concentrated on the numerical integrations in terms of unit quaternions for the simulation of rigid body dynamics, especially the conserving integrations [11, 15,16,17,18,19,20].

In this previous work, an essential process is to derive the dynamic description of rigid body rotation, which leads to different inertia representations in terms of unit quaternions, embodied by the mass matrix in the kinetic energy. In rigid body dynamics, the quaternion-based kinetic energy is commonly derived from the standard quadratic form of the angular velocity, which generally results in a singular mass matrix. To avoid the singularity, Betsch and Siebert [11] proposed an augmented mass matrix when deriving the conserving numerical integration in terms of unit quaternions for rigid body dynamics. Besides, similar approaches [12,13,14,15,16] were proposed to describe the motion equations, which also lead to a non-singular mass matrix. In this work, an additional parameter denoted as \(\alpha \) in this paper, is generally added in the original formulation of kinetic energy. Nielsen and Krenk [16] developed the quaternion-based momentum scheme based on the non-singular mass matrix, and suggested that the additional parameter served as a multiplier on the kinematic constraint, and better convergence characteristics could be achieved by choosing this parameter somewhat larger than the inertial moments in numerical simulation. Recently, a modified inertia representation [23] was proposed for the quaternion-based rigid body dynamics, in which a new parameter, denoted \(\gamma \) in this paper, was introduced in the kinetic energy. The parameters \(\alpha \) and \(\gamma \) are mathematically equivalent if the unit length constraint is satisfied exactly. Nevertheless, the two parameters are different in discretization, and numerical results demonstrate that the parameter \(\gamma \) is superior to \(\alpha \) because it can be used to improve the numerical accuracy of integration in simulation.

In this paper, the numerical performance of different inertia representations is investigated at great length for the quaternion-based rigid body dynamics. In Sect. 2, we first derive the Hamilton equations for the rigid body dynamics in terms of unit quaternions, and classify these equations into two types: the first is based on the augmented formulation of kinetic energy, denoted as \(\alpha \)-type, and the other is according to the modified inertia representation, denoted as \(\gamma \)-type. In Sect. 3, error estimation demonstrates that the Hamiltonians in \(\alpha \)-type and \(\gamma \)-type are essentially different from the point of view of discretization, and it suggests that the parameter \(\gamma \) is expected to have great influence on the discretization error of kinetic energy. Based on the error estimation, two predetermined values \(\gamma _{\mathrm{m}}\) and \(\gamma _{ \mathrm{h}}\) are recognized to reduce numerical errors for the integrations of \(\gamma \)-type.

Section 4 develops several kinds of integrations, especially the specialized partitioned additive Runge–Kutta methods (SPARK) [24] for rigid body dynamics in terms of unit quaternions, according to the Hamilton equations of \(\alpha \)-type and \(\gamma \)-type. Section 5 systematically investigates the numerical accuracy and stability for these integrations. Numerical results demonstrate that most of the integrations of \(\gamma \)-type assigned with \(\gamma = \gamma _{ \mathrm{m}}\) or \(\gamma _{\mathrm{h}}\) can present impressively better numerical accuracy than those of \(\alpha \)-type, especially for the Gauss SPARK methods. All the integrations of \(\gamma \)-type can present better convergence speed and stronger robustness for the newton iteration than those of \(\alpha \)-type. A large amount of numerical comparisons reveal that the numerical performance of the integrations is extensively influenced by the inertia representations, discretization schemes and their combinations. The findings of this paper suggest that numerical integrations in terms of unit quaternions should be constructed with an appropriate inertia representation in order to obtain better numerical accuracy, convergence speed and stability.

2 Kinematic description

The unit quaternion can be considered as a four-parameter vector [16]:

$$ \boldsymbol{q}^{T} = \left [ \textstyle\begin{array}{c@{\quad}c@{\quad}c@{\quad}c} q_{0} & q_{1} & q_{2} & q_{3} \end{array}\displaystyle \right ] $$
(1)

with an algebraic constraint,

$$ \boldsymbol{q}^{T}\boldsymbol{q} - 1 = 0. $$
(2)

An important application of unit quaternions is that the three-dimensional orthogonal matrix can be expressed in terms of unit quaternions:

$$ \boldsymbol{R}(\boldsymbol{q}) = \left [ \textstyle\begin{array}{c@{\quad}c@{\quad}c} q_{0}^{2} + q_{1}^{2} - q_{2}^{2} - q_{3}^{2} & 2(q_{1}q_{2} - q_{0}q _{3}) & 2(q_{1}q_{3} + q_{0}q_{2}) \\ 2(q_{1}q_{2} + q_{0}q_{3}) & q_{0}^{2} - q_{1}^{2} + q_{2}^{2} - q _{3}^{2} & 2(q_{2}q_{3} - q_{0}q_{1}) \\ 2(q_{1}q_{3} - q_{0}q_{2}) & 2(q_{2}q_{3} + q_{0}q_{1}) & q_{0}^{2} - q_{1}^{2} - q_{2}^{2} + q_{3}^{2} \end{array}\displaystyle \right ], $$
(3)

where \(\boldsymbol{R}\) satisfies the orthogonal condition \(\boldsymbol{R}^{T}\boldsymbol{R} = \boldsymbol{RR}^{T} = \boldsymbol{I}_{3}\) and \(\boldsymbol{I}_{3}\) is the 3-dimensional identity matrix. In rigid body dynamics, \(\boldsymbol{R}\) is named the rotation matrix; it maps from the space-fixed coordinates \(\boldsymbol{X}\) to the body-fixed coordinate \(\boldsymbol{x}\), i.e.,

$$ \boldsymbol{x} = \boldsymbol{RX}. $$
(4)

Differentiating (4), we can derive the following motion equations:

$$ \dot{\boldsymbol{R}} = \boldsymbol{R}\hat{\boldsymbol{\varOmega }}, $$
(5)

where the superscript ‘dot’ denotes the derivation of variables with respect to time, and the matrix \(\hat{\boldsymbol{\varOmega}} \) is in the form of

$$ \hat{\boldsymbol{\varOmega}} = \left [ \textstyle\begin{array}{c@{\quad}c@{\quad}c} 0 & - \varOmega _{ 3} & \varOmega _{ 2} \\ \varOmega _{3} & 0 & - \varOmega _{ 1} \\ - \varOmega _{ 2} & \varOmega _{ 1} & 0 \end{array}\displaystyle \right ], $$
(6)

where \(\boldsymbol{\varOmega } = [ \begin{array}{c@{\ }c@{\ }c} \varOmega _{ 1} & \varOmega _{ 2} & \varOmega _{ 3} \end{array} ]^{T}\) is the angular velocity vector. Substituting (3) into (5) leads to the quaternion-based motion equations [11]

$$ \boldsymbol{\varOmega } = 2\boldsymbol{L}(\boldsymbol{q}) \dot{\boldsymbol{q}}, $$
(7)

where

$$ \boldsymbol{L}(\boldsymbol{q}) = \left [ \textstyle\begin{array}{c@{\quad}c@{\quad}c@{\quad}c} - q_{1} & q_{0} & q_{3} & - q_{2} \\ - q_{2} & - q_{3} & q_{0} & q_{1} \\ - q_{3} & q_{2} & - q_{1} & q_{0} \end{array}\displaystyle \right ]. $$
(8)

Noting that \(\boldsymbol{q}^{T}\boldsymbol{q} = 1\), a direct calculation reveals that

$$\begin{gathered} \boldsymbol{L}(\boldsymbol{q})\boldsymbol{q} = \boldsymbol{0},\qquad \boldsymbol{L}(\boldsymbol{q})\dot{\boldsymbol{q}} = - \boldsymbol{L}( \dot{\boldsymbol{q}})\boldsymbol{q},\qquad \boldsymbol{L}( \dot{\boldsymbol{q}})\dot{\boldsymbol{q}} = \boldsymbol{0}, \end{gathered}$$
(9)
$$\begin{gathered} \boldsymbol{L}(\boldsymbol{q})\boldsymbol{L}^{T}(\boldsymbol{q}) = \boldsymbol{I}_{3}, \end{gathered}$$
(10)
$$\begin{gathered} \boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{L}(\boldsymbol{q}) = \boldsymbol{I}_{4} - \boldsymbol{qq}^{T}, \end{gathered}$$
(11)

where \(\boldsymbol{I}_{n}\) denotes the \(n\)-dimensional identity matrix. These identity relations are useful in later discussion.

3 The rotational motion equations in the Hamiltonian framework

In the Hamiltonian description of conservative system, the motion equations can be expressed in a unified form [25]:

$$ \begin{aligned} \dot{\boldsymbol{q}} &= H_{\boldsymbol{p}}(\boldsymbol{q}, \boldsymbol{p}), \\ \dot{\boldsymbol{p}} &= - H_{\boldsymbol{q}}(\boldsymbol{q}, \boldsymbol{p}) - g_{\boldsymbol{q}}(\boldsymbol{q})\lambda, \\ 0 &= g(\boldsymbol{q}), \\ 0 &= g_{\boldsymbol{q}}(\boldsymbol{q})^{T}H_{\boldsymbol{p}}( \boldsymbol{q},\boldsymbol{p}), \end{aligned} $$
(12)

where the third and fourth equations denote the constraint conditions. The Hamiltonian

$$ H = T(\boldsymbol{q}, \boldsymbol{p}) + V(\boldsymbol{q}) $$
(13)

consists of the kinetic energy \(T \)and the potential energy \(V\), and the abbreviations are defined as \(H_{\boldsymbol{p}} = \partial H / \partial \boldsymbol{p}^{T}\), \(H_{\boldsymbol{q}} = \partial H / \partial \boldsymbol{q}^{T}\) and \(g_{\boldsymbol{q}}(\boldsymbol{q}) = \partial g / \partial \boldsymbol{q}^{T}\). \(\lambda \) is the Lagrange multiplier which preserves the path of quaternions satisfying \(g ( q ) = \boldsymbol{0}\), and \(\mathbf{p} \) denotes the generalized momentum. For the quaternion-based rigid body rotational motion, we have \(g(\boldsymbol{q}) = \boldsymbol{q}^{T}\boldsymbol{q} - 1\) and \(g_{\boldsymbol{q}}(\boldsymbol{q}) = 2\boldsymbol{q}\).

Suppose that the body-fixed coordinate axes are aligned along the principal axes of the inertia of the rigid body, and \(\boldsymbol{J} = \operatorname{diag}(I_{1}, I_{2}, I_{3})\) denotes the inertia matrix whose principal elements are three principal moments of inertia. Combined with (7), the kinetic energy of the rigid body rotation can be expressed as

$$ T = \boldsymbol{\varOmega J\varOmega } / 2 = 2\dot{\boldsymbol{q}}^{T} \boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{JL}(\boldsymbol{q}) \dot{\boldsymbol{q}}. $$
(14)

Based on a Legendre transformation, the generalized momentum can be derived as

$$ \boldsymbol{p} = \partial T / \partial \dot{\boldsymbol{q}}^{T} = \boldsymbol{M}\dot{\boldsymbol{q}}, $$
(15)

where

$$ \boldsymbol{M} = 4\boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{JL}( \boldsymbol{q}) $$
(16)

is defined as the mass matrix. Multiplying (15) with \(\boldsymbol{q} ^{T}\)from the left and recalling \(\boldsymbol{L}(\boldsymbol{q}) \boldsymbol{q} = \boldsymbol{0}\), we have

$$ \boldsymbol{q}^{T}\boldsymbol{p} = \boldsymbol{p}^{T}\boldsymbol{q} = 0, $$
(17)

which is equivalent to the constraint \(0 = g_{\boldsymbol{q}}( \boldsymbol{q})H_{\boldsymbol{p}}(\boldsymbol{q},\boldsymbol{p})\) for unit quaternions. Multiplying (15) with \(\boldsymbol{L}( \boldsymbol{q})\) from the left and recalling \(\boldsymbol{L}( \boldsymbol{q})\boldsymbol{L}(\boldsymbol{q})^{T} = \boldsymbol{I} _{3}\), we have

$$ \boldsymbol{L}(\boldsymbol{q})\boldsymbol{p} = 4\boldsymbol{L}( \boldsymbol{q})\boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{JL}( \boldsymbol{q})\dot{\boldsymbol{q}} = 4\boldsymbol{JL}(\boldsymbol{q}) \dot{\boldsymbol{q}}. $$
(18)

Noting that \(\boldsymbol{\varOmega } = 2\boldsymbol{L}(\boldsymbol{q}) \dot{\boldsymbol{q}}\) and \(\boldsymbol{l} = \boldsymbol{J\varOmega } \) where \(\boldsymbol{l}\) denotes the local angular momentum, it can be derived that

$$ \boldsymbol{l} = \boldsymbol{J\varOmega } = 2\boldsymbol{JL}( \boldsymbol{q})\dot{\boldsymbol{q}} = \frac{1}{2}\boldsymbol{L}( \boldsymbol{q})\boldsymbol{p} = - \frac{1}{2}\boldsymbol{L}( \boldsymbol{p})\boldsymbol{q}, $$
(19)

where the local angular momentum can be expressed as a function of \(\boldsymbol{q}\) and \(\boldsymbol{p}\). Substitute \(\boldsymbol{\varOmega } = \boldsymbol{J}^{ - 1}\boldsymbol{l}\) into (14) and we can derive the kinetic energy in the Hamiltonian framework:

$$ T = \boldsymbol{l}^{T}\boldsymbol{J}^{ - 1}\boldsymbol{l} / 2 = \frac{1}{8}\boldsymbol{p}^{T}\boldsymbol{L}(\boldsymbol{q})^{T} \boldsymbol{J}^{ - 1}\boldsymbol{L}(\boldsymbol{q})\boldsymbol{p}. $$
(20)

Substituting (20) into the first two equations in (12), we can derive the differential parts of the Hamilton’s equations in the following form:

$$ \begin{aligned} \dot{\boldsymbol{q}} &= \frac{1}{4}\boldsymbol{L}(\boldsymbol{q})^{T} \boldsymbol{J}^{ - 1}\boldsymbol{L}(\boldsymbol{q})\boldsymbol{p}, \\ \dot{\boldsymbol{p}} &= - \frac{1}{4}\boldsymbol{L}(\boldsymbol{p})^{T} \boldsymbol{J}^{ - 1}\boldsymbol{L}(\boldsymbol{p})\boldsymbol{q} - \partial V / \partial \boldsymbol{q} - 2\lambda \boldsymbol{q}, \end{aligned} $$
(21)

where the multiplier \(\lambda \) is used to preserve the constraint \(\boldsymbol{q}^{T}\boldsymbol{q} - 1 = 0\).

3.1 The inertia representations of \(\alpha \)-type and \(\gamma \)-type

The numerical application of the Hamilton’s equations (21) is complicated because of the singularity of the matrix \(\frac{1}{4} \boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{J}^{ - 1}\boldsymbol{L}( \boldsymbol{q})\). To avoid the singularity, researchers [11,12,13,14,15,16] introduced an additional term \(\alpha ^{ - 1}(\boldsymbol{p}^{T} \boldsymbol{q})^{2}\) into the original formulation of kinetic energy. Generally, the augmented formulation of the kinetic energy can be expressed as

$$ T = \frac{1}{8}\boldsymbol{p}^{T}\boldsymbol{L}( \boldsymbol{q})^{T} \boldsymbol{J}^{ - 1}\boldsymbol{L}( \boldsymbol{q})\boldsymbol{p} + \frac{1}{8}\alpha ^{ - 1}\bigl( \boldsymbol{p}^{T}\boldsymbol{q}\bigr)^{2}. $$
(22)

Because of \(\boldsymbol{p}^{T}\boldsymbol{q} = 0\), the term \(\frac{1}{8}\alpha ^{ - 1}(\boldsymbol{p}^{T}\boldsymbol{q})^{2}\) has no influence on the value of the kinetic energy. Substituting (22) into (12), we can derive the Hamilton’s equations of \(\alpha \)-type:

$$ \begin{aligned} \dot{\boldsymbol{q}} &= \frac{1}{4} \boldsymbol{L}(\boldsymbol{q})^{T} \boldsymbol{J}^{ - 1} \boldsymbol{L}(\boldsymbol{q})\boldsymbol{p} + \frac{1}{4}\alpha ^{ - 1}\boldsymbol{qq}^{T}\boldsymbol{p}, \\ \dot{\boldsymbol{p}}& = - \frac{1}{4}\boldsymbol{L}( \boldsymbol{p})^{T} \boldsymbol{J}^{ - 1}\boldsymbol{L}( \boldsymbol{p})\boldsymbol{q} - \frac{1}{4}\alpha ^{ - 1}\bigl( \boldsymbol{p}^{T}\boldsymbol{q}\bigr) \boldsymbol{p} - \partial V / \partial \boldsymbol{q} - 2\lambda \boldsymbol{q}, \end{aligned} $$
(23)

where the multiplier \(\lambda \) is used to preserve the constraint \(\boldsymbol{q}^{T}\boldsymbol{q} - 1 = 0\). The corresponding matrix \(\frac{1}{4}\boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{J}^{ - 1} \boldsymbol{L}(\boldsymbol{q}) + \frac{1}{4}\alpha ^{ - 1} \boldsymbol{qq}^{T}\) in (23) is non-singular if only \(\alpha ^{ - 1} \ne 0\). Numerical results demonstrate that the conserving integrations of \(\alpha \)-type can present good long-time behavior in simulations [11, 16].

Noting that \(\boldsymbol{l} = - \frac{1}{2}\boldsymbol{L}( \boldsymbol{p})\boldsymbol{q}\), \(\boldsymbol{L}(\boldsymbol{q})^{T} \boldsymbol{L}(\boldsymbol{q}) + \boldsymbol{qq}^{T} = \boldsymbol{I} _{4}\) and \(\boldsymbol{q}^{T}\boldsymbol{p} = 0\), we have

$$ \boldsymbol{l}^{T}\boldsymbol{l} = \frac{1}{4}\boldsymbol{p}^{T} \boldsymbol{p}. $$
(24)

Let us reformulate the kinetic energy in the following form:

$$ T = \boldsymbol{l}^{T}\boldsymbol{J}^{ - 1}\boldsymbol{l} / 2 = \gamma ^{ - 1}\boldsymbol{l}^{T}\boldsymbol{l} / 2 + \boldsymbol{l} ^{T}\boldsymbol{J}_{\gamma }^{*}\boldsymbol{l} / 2, $$
(25)

where \(\gamma \) is an arbitrary constant and \(\gamma \ne 0\), and \(\boldsymbol{J}_{\gamma }^{*} = \boldsymbol{J}^{ - 1} - \gamma ^{ - 1} \boldsymbol{I}_{3}\). Substituting (19) and (24) into (25) yields a new formulation:

$$ T = \frac{1}{8}\gamma ^{ - 1}\boldsymbol{p}^{T}\boldsymbol{p} + \frac{1}{8}\boldsymbol{p}^{T}\boldsymbol{L}(\boldsymbol{q})^{T} \boldsymbol{J}_{\gamma }^{*}\boldsymbol{L}(\boldsymbol{q}) \boldsymbol{p}, $$
(26)

where the kinetic energy is split into two components. The first is a square term of the quaternion momentum, whose magnitude is adjusted by the parameter \(\gamma \). The other is a quadratic form in the derivatives with quadratic coefficients in the quaternion parameters. Equation (26) is the modified inertia representation presented by Xu and Zhong [23]. Substituting (26) into (12) yields the Hamilton’s equations of \(\gamma \)-type:

$$ \begin{aligned} \dot{\boldsymbol{q}} &= \frac{1}{4}\gamma ^{ - 1}\boldsymbol{p} + \frac{1}{4}\boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{J}_{\gamma } ^{*}\boldsymbol{L}(\boldsymbol{q})\boldsymbol{p}, \\ \dot{\boldsymbol{p}} &= - \frac{1}{4}\boldsymbol{L}(\boldsymbol{p})^{T} \boldsymbol{J}_{\gamma }^{*}\boldsymbol{L}(\boldsymbol{p}) \boldsymbol{q} - \partial V / \partial \boldsymbol{q} - 2\lambda \boldsymbol{q}, \end{aligned} $$
(27)

where the multiplier \(\lambda \) is used to preserve the constraint \(\boldsymbol{q}^{T}\boldsymbol{q} - 1 = 0\).

The inertia representations of \(\alpha \) and \(\gamma \)-type are mathematically equivalent under certain condition. To be specific, it can be derived that

$$\begin{aligned} T& = \frac{1}{8}\gamma ^{ - 1}\boldsymbol{p}^{T} \boldsymbol{p} + \frac{1}{8}\boldsymbol{p}^{T} \boldsymbol{L}(\boldsymbol{q})^{T}\bigl( \boldsymbol{J}^{ - 1} - \gamma ^{ - 1}\boldsymbol{I}_{3}\bigr) \boldsymbol{L}( \boldsymbol{q})\boldsymbol{p} \\ &= \frac{1}{8}\alpha ^{ - 1}\boldsymbol{p}^{T} \bigl[\boldsymbol{L}( \boldsymbol{q})^{T}\boldsymbol{L}( \boldsymbol{q}) + \boldsymbol{qq} ^{T}\bigr]\boldsymbol{p} + \frac{1}{8}\boldsymbol{p}^{T}\boldsymbol{L}( \boldsymbol{q})^{T}\bigl(\boldsymbol{J}^{ - 1} - \alpha ^{ - 1} \boldsymbol{I}_{3}\bigr)\boldsymbol{L}( \boldsymbol{q})\boldsymbol{p} \\ &= \frac{1}{8}\boldsymbol{p}^{T}\boldsymbol{L}( \boldsymbol{q})^{T} \boldsymbol{J}^{ - 1}\boldsymbol{L}( \boldsymbol{q})\boldsymbol{p} + \frac{1}{8}\alpha ^{ - 1}\bigl( \boldsymbol{p}^{T}\boldsymbol{q}\bigr)^{2} \end{aligned}$$
(28)

by considering \(\gamma = \alpha \) and \(\boldsymbol{I}_{4} = \boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{L}(\boldsymbol{q}) + \boldsymbol{qq}^{T}\). The mathematical equivalence implies that the parameters \(\alpha \) and \(\gamma \) theoretically have no influence on the value of the kinetic energy if the constraint \(\boldsymbol{q}^{T} \boldsymbol{q} - 1 = 0\) is satisfied exactly. In the following, the two representations and the corresponding parameters \(\alpha \) and \(\gamma \) will be systematically studied both in theoretical analysis and numerical simulation, and the numerical performance of the two parameters \(\alpha \) and \(\gamma \) would be investigated intensively with several different discretized schemes and convergence orders.

3.2 The discretization error estimation

Suppose that \(\boldsymbol{q} = \boldsymbol{q}(t)\) and \(\boldsymbol{p} = \boldsymbol{p}(t)\) denote the real solutions of rotational motion of a single body, and that \(\boldsymbol{q}^{ +} = \boldsymbol{q}^{ +} (t)\)and \(\boldsymbol{p}^{ +} = \boldsymbol{p}^{ +} (t)\) are their interpolation approximation solutions. We can define the real angular momentum and its approximation in the following form:

$$ \boldsymbol{l} = \boldsymbol{l}(\boldsymbol{q}, \boldsymbol{p}),\qquad \boldsymbol{l}^{ +} = \boldsymbol{l}\bigl(\boldsymbol{q}^{ +}, \boldsymbol{p}^{ +} \bigr). $$
(29)

Then the local discretization error of \(\boldsymbol{q}\) and \(\boldsymbol{l}\) can be defined, respectively, as

$$ \delta \boldsymbol{q} = \boldsymbol{q}^{ +} (t) - \boldsymbol{q}(t),\qquad \delta \boldsymbol{p} = \boldsymbol{p}^{ +} (t) - \boldsymbol{p}(t) $$
(30)

and

$$ \delta \boldsymbol{l} = \boldsymbol{l}^{ +} - \boldsymbol{l} = \frac{1}{2}\delta \bigl(\boldsymbol{L}(\boldsymbol{q})\boldsymbol{p} \bigr) = \frac{1}{2}(\delta \boldsymbol{L})\boldsymbol{p} + \frac{1}{2} \boldsymbol{L}\delta \boldsymbol{p} + \frac{1}{2} \delta \boldsymbol{L}\delta \boldsymbol{p}, $$
(31)

where \(\delta \boldsymbol{L} = \boldsymbol{L}(\boldsymbol{q}^{ +} ) - \boldsymbol{L}(\boldsymbol{q})\). The constraint \(\boldsymbol{q}^{T} \boldsymbol{q} = 1\) is satisfied approximately as

$$ \boldsymbol{q}^{ +T}\boldsymbol{q}^{ +} = 1 + 2\boldsymbol{q}^{T} \delta \boldsymbol{q} + \delta \boldsymbol{q}^{T}\delta \boldsymbol{q}. $$
(32)

Considering the inertia representation of \(\gamma \)-type, the discretization error of kinetic energy can be formally expressed as

$$ \delta T_{\gamma } = T\bigl(\boldsymbol{q}^{ +}, \boldsymbol{p}^{ +}, \gamma \bigr) - T(\boldsymbol{q}, \boldsymbol{p}, \gamma ). $$
(33)

Consider Eq. (26) and substitute (29) and (31) into (33), and then the discretization error of kinetic energy of \(\gamma \)-type can be expressed as

$$ \delta T_{{\gamma }} = k_{s}\gamma ^{ - 1} + \delta T_{0}, $$
(34)

where the slope is defined as

$$ k_{s} = \frac{1}{8}\bigl(\boldsymbol{p}^{ +T} \boldsymbol{p}^{ +} - 4 \boldsymbol{l}^{ +T} \boldsymbol{l}^{ +} \bigr), $$
(35)

and the intercept is of the form of

$$ \delta T_{0} = \delta \boldsymbol{l}^{T}\boldsymbol{J}^{ - 1} \boldsymbol{l} + \delta \boldsymbol{l}^{T}\boldsymbol{J}^{ - 1}\delta \boldsymbol{l} / 2. $$
(36)

Note that \(\delta T_{0}\) is the discretization error of the original formulation of kinetic energy presented by (20). Similarly, we can derive the discretization error of kinetic energy of \(\alpha \)-type, which is

$$\begin{aligned} \delta T_{\alpha } &= T\bigl(\boldsymbol{q}^{ +}, \boldsymbol{p}^{ +}, \alpha \bigr) - T(\boldsymbol{q}, \boldsymbol{p}, \alpha ) \\ &= k_{a}\alpha ^{ - 1} + \delta T_{0} \end{aligned}$$
(37)

with the slope

$$ k_{a} = 8^{ - 1}\bigl(\boldsymbol{p}^{ + T} \boldsymbol{q}^{ +} \bigr)^{2}. $$
(38)

Equations (34) and (37) reveal the linear relation between the energy error and \(1/\gamma \) or \(1 / \alpha \). This relation can be exploited to reduce the numerical errors of integrations by choosing the appropriate \(\gamma \) or \(\alpha \) to cancel out the intercept term \(\delta T_{0}\), as done in [23]. For this to work, the slope should ideally be of the same convergence order as \(\delta T_{0}\). However, this is not always the case for the inertia representation of \(\alpha \)-type. More specifically, substituting \(\boldsymbol{q}^{ +} = \boldsymbol{q} + \delta \boldsymbol{q}\) and \(\boldsymbol{p}^{ +} = \boldsymbol{p} + \delta \boldsymbol{p}\) into (38) and recalling \(\boldsymbol{q}^{T}\boldsymbol{p} = 0\) yield

$$ k_{a} = 8^{ - 1}\bigl(\boldsymbol{q}^{T}\delta \boldsymbol{p} + \boldsymbol{p}^{T}\delta \boldsymbol{q} + \delta \boldsymbol{p}^{T} \delta \boldsymbol{q}\bigr)^{2}. $$
(39)

When the error terms \(\delta \boldsymbol{q}\)and \(\delta \boldsymbol{p}\) are of the same convergence order (i.e., \(O(\delta \boldsymbol{q}) = O(\delta \boldsymbol{p})\)), Eq. (39) means \(k_{a}\) is generally a second-order small quantity with respect to \(\delta \boldsymbol{q}\) and \(\delta \boldsymbol{p}\). In this case, the slope \(k_{a}\) vanishes more quickly than the term \(\delta T_{0}\) when the discretization errors \(\delta \boldsymbol{q}\) and \(\delta \boldsymbol{p}\) tend to be zero. Accordingly, the corresponding parameter \(\alpha \) has nearly no influence on the discretization errors.

On the other hand, for the inertia representation of \(\gamma \)-type, the slope \(k_{s}\) can be expanded as

$$ k_{s} = \biggl(\frac{1}{4}\delta \boldsymbol{p}^{T} \boldsymbol{p} - \delta \boldsymbol{l}^{T}\boldsymbol{l}\biggr) + \frac{1}{2}\biggl(\frac{1}{4}\delta \boldsymbol{p}^{T} \delta \boldsymbol{p} - \delta \boldsymbol{l}^{T} \delta \boldsymbol{l}\biggr), $$
(40)

where the second term on the right side is a second-order small quantity. Ignoring the second-order small quantity and considering \(\boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{L}(\boldsymbol{q}) + \boldsymbol{qq}^{T} = \boldsymbol{I}_{4}\) and \(\boldsymbol{p}^{T} \boldsymbol{q} = 0\), we can obtain

$$ k_{s} \approx - \frac{1}{4}\boldsymbol{p}^{T}( \delta \boldsymbol{L})^{T} \boldsymbol{Lp}, $$
(41)

where the error term \(\delta \boldsymbol{L}\) is of the same order with the discretization error \(\delta \boldsymbol{q}\). One can expect

$$ k_{s} \propto O\bigl( \| \delta \boldsymbol{q} \|\bigr) $$
(42)

for any \(\boldsymbol{q}\) and \(\boldsymbol{p}\), where \(\left \| \delta \boldsymbol{q} \right \| = \sqrt{\delta \boldsymbol{q}^{T}\delta \boldsymbol{q}}\) denotes the 2-norm of \(\delta \boldsymbol{q}\). This implies that the slope \(k_{s}\) is of the same order as \(\delta T_{0}\), and the discretization error of kinetic energy will be greatly influenced by the parameter \(\gamma \).

We note that it is not always straightforward to verify (42) when we investigate the integration schemes. Instead, a more practical condition can be used. Substituting \(\boldsymbol{l}^{ +} = - \frac{1}{2} \boldsymbol{L}(\boldsymbol{p}^{ +} )\boldsymbol{q}^{ +} \) into (35) and considering that\((\boldsymbol{p}^{ + T}\boldsymbol{q}^{ +} )^{2} = O[( \delta \boldsymbol{q})^{2},(\delta \boldsymbol{p})^{2}]\), the slope \(k_{s}\) can be reformulated as

$$ k_{s} + O\bigl[(\delta \boldsymbol{q})^{2},(\delta \boldsymbol{p})^{2}\bigr] = \frac{1}{8}\boldsymbol{p}^{ +T} \bigl(\boldsymbol{I}_{4} - \boldsymbol{L}\bigl( \boldsymbol{q}^{ +} \bigr)^{T}\boldsymbol{L}\bigl(\boldsymbol{q}^{ +} \bigr) + \boldsymbol{q}^{ +} \boldsymbol{q}^{ + T}\bigr) \boldsymbol{p}^{ +}. $$
(43)

This suggests that the interpolation function should satisfy a necessary but not sufficient condition:

$$ \boldsymbol{L}\bigl(\boldsymbol{q}^{ +} \bigr)^{T} \boldsymbol{L}\bigl(\boldsymbol{q} ^{ +} \bigr) + \boldsymbol{q}^{ +} \boldsymbol{q}^{ +T} = \boldsymbol{I} _{4} + O(\delta \boldsymbol{q}) $$
(44)

for \(\boldsymbol{q}^{ +} = \boldsymbol{q}^{ +} (t)\), to preserve \(k_{s} \propto O(\delta \boldsymbol{q})\).

Condition (44) means that, for \(k_{s}\) to be exploitable, we actually want the constraint on the unit quaternion to be satisfied only to the same order approximately, but not to higher order or exactly. As we will show in the following, Condition (44) can easily be verified, especially for the Gauss SPARK methods.

3.3 The optimal value of parameter \(\gamma \)

Suppose that the integrations satisfy (42) at every discretized points. The error estimation in (34) suggests a linear relationship between \(\delta T\) and \(\gamma ^{ - 1}\). Let \(\delta T = 0\) in (34), and it gives the optimal value of the parameter \(\gamma \) in the following form:

$$ \gamma _{\mathrm{opt}} = - \frac{k_{s}}{\delta T_{0}} \approx \frac{1}{4}\frac{\boldsymbol{p}^{T}(\delta \boldsymbol{L})^{T} \boldsymbol{Lp}}{\delta \boldsymbol{l}^{T}\boldsymbol{J}^{ - 1} \boldsymbol{l}}, $$
(45)

where higher-order terms are neglected. This is a reasonable value for the parameter \(\gamma \) to obtain a smaller discretization error and is expected to improve the numerical accuracy for the integrations of \(\gamma \)-type. Unfortunately, the quantities \(k_{s}\) and \(\delta T _{0}\) are unknown during the simulation. Substituting \(\boldsymbol{l} = - \frac{1}{2}\boldsymbol{Lp}\) and \(\delta \boldsymbol{l} \approx \frac{1}{2}(\delta \boldsymbol{L})\boldsymbol{p} + \frac{1}{2} \boldsymbol{L}\delta \boldsymbol{p}\) into (45), yields

$$ \gamma _{\mathrm{opt}} \approx \frac{\sum _{i = 1}^{3} w_{i}}{\sum _{i = 1}^{3} w_{i}I_{i}^{ - 1}}, $$
(46)

where \(\boldsymbol{l} = [l_{1}, l_{2}, l_{3}]^{T}\), \(w_{i} = l_{i} \delta l_{i}\) (\(i = 1, 2, 3\)) and the error term \(\delta \boldsymbol{p}\) is neglected. Let \(w_{1} = w_{2} = w_{3} = 1\), and it gives the harmonic average of the three principal moments:

$$ \gamma _{\mathrm{h}} = \frac{3}{I_{1}^{ - 1} + I_{2}^{ - 1} + I_{3} ^{ - 1}}. $$
(47)

Let \(w_{1} = I_{1}\), \(w_{2} = I_{2}\) and \(w_{3} = I_{3}\), and it gives the arithmetic average of the three principal moments:

$$ \gamma _{\mathrm{m}} = \frac{I_{1} + I_{2} + I_{3}}{3}. $$
(48)

The values \(\gamma _{\mathrm{m}}\) and \(\gamma _{\mathrm{h}}\) are recommended as two reasonable values of \(\gamma \) for integrations of \(\gamma \)-type.

In addition, the two optimal values \(\gamma _{\mathrm{m}}\) and \(\gamma _{\mathrm{h}}\) present very similar numerical performance when the three principal moments (i.e., \(I_{1}\), \(I_{2}\) and \(I_{3}\)) have close values. Nevertheless, the values \(\gamma _{\mathrm{m}}\)and \(\gamma _{\mathrm{h}}\) become very different if there are large differences among the three principal moments. For instance, suppose that \(I_{3} \to 0\), and that \(I_{1}\) and \(I_{2}\) remain unchanged. We thus obtain

$$ \gamma _{\mathrm{h}} \to 0, \qquad\gamma _{\mathrm{m}} \to \frac{I_{1} + I _{2}}{3}. $$
(49)

Because \(\delta T_{{\gamma }} = k_{s}\gamma ^{ - 1} + \delta T_{0} \to \infty \) when \(\gamma \to 0\), Eq. (49) implies a potential risk of serious accuracy loss in simulation for the integrations of \(\gamma \)-type with \(\gamma = \gamma _{\mathrm{h}}\). On the other hand, it can be derived that \(T = (I_{1}\varOmega _{1}^{2} + I_{2}\varOmega _{2} ^{2}) / 2 = (I_{1}^{ - 1}l_{1}^{2} + I_{2}^{ - 1}l_{2}^{2}) / 2\) by setting \(I_{3} = 0\). It means that \(l_{3}\) has no contribution to the kinetic energy nor to the discretization error if \(I_{3} = 0\). Consequently, substituting \([w_{1}, w_{2}, w_{3}]= [1,1,0]\) and \([w _{1}, w_{2}, w_{3}]=[I_{1}, I_{2}, 0]\) into (46) and we can derive the correct optimal values of the parameter \(\gamma \) for the case \(I_{3} \to 0\) as follows:

$$ \tilde{\gamma }_{\mathrm{h}} = \gamma _{\mathrm{h}}(I_{3} \to 0) = \frac{2}{I _{1}^{ - 1} + I_{2}^{ - 1}},\qquad \tilde{\gamma }_{\mathrm{m}} = \gamma _{\mathrm{m}}(I_{3} \to 0) = \frac{I_{1} + I_{2}}{2}. $$
(50)

Compared to (49), it reveals that the value \(\gamma _{\mathrm{h}}\) in (47) tends to magnify the numerical influence of the smallest value of the three principal moments. These subtleties should be considered in simulation.

4 Numerical integrations of \(\gamma \)-type and \(\alpha \)-type

There is no restriction on the convergence order of the numerical integrations in the error analysis, which implies that the inertia representation of \(\gamma \)-type can be used to improve the numerical accuracy regardless of the convergence order of the algorithm. In the following, numerical integrations with different discretization schemes are developed and compared between the \(\alpha \)-type and the \(\gamma \)-type, in order to demonstrate the widespread applicability of the inertia representation in numerical simulation.

4.1 Numerical integrations of order 2

Let the phase space coordinates \((\boldsymbol{q}_{k - 1}, \boldsymbol{p}_{k - 1})\) at \(t_{k - 1}\) along with the step-size \(\Delta t = t_{k} - t_{k - 1}\) be given. Define the mean values as

$$ \bar{\boldsymbol{q}} = \frac{1}{2}(\boldsymbol{q}_{k - 1} + \boldsymbol{q}_{k}),\qquad \bar{\boldsymbol{p}} = \frac{1}{2}( \boldsymbol{p}_{k - 1} + \boldsymbol{p}_{k}) $$
(51)

and the increments as

$$ \Delta \boldsymbol{q} = \boldsymbol{q}_{k} - \boldsymbol{q}_{k - 1},\qquad \Delta \boldsymbol{p} = \boldsymbol{p}_{k} - \boldsymbol{p}_{k - 1} $$
(52)

for time interval \(t \in [t_{k - 1}, t_{k}]\).

Implicit midpoint scheme (IMS)

Approximating the Hamilton’s equation in (12) by the midpoint rule gives the following scheme:

$$ \begin{aligned} \Delta \boldsymbol{q} / \Delta t& = H_{\boldsymbol{p}}( \bar{\boldsymbol{q}},\bar{\boldsymbol{p}}),\qquad 0 = g(\boldsymbol{q}_{k}), \\ \Delta \boldsymbol{p} / \Delta t& = - H_{\boldsymbol{q}}( \bar{\boldsymbol{q}},\bar{\boldsymbol{p}}) - 2\lambda \bar{\boldsymbol{q}}, \end{aligned} $$
(53)

where the unknowns\(\boldsymbol{q}_{k}\), \(\boldsymbol{p}_{k}\)and\(\lambda \)can be solved for the given\(\boldsymbol{q}_{k - 1}\)and\(\boldsymbol{p}_{k - 1}\). The schemes are abbreviated as IMS-\(\alpha \)and IMS-\(\gamma \)for the integrations of\(\alpha \)-type and\(\gamma \)-type, respectively.

The second integration we are interested in is the energy–momentum preserving integration developed in Refs. [11, 16, 26]. To this end, we consider the increment of the Hamiltonian:

$$ \Delta H = \Delta T + \Delta V, $$
(54)

where the increments \(\Delta T = T(\boldsymbol{q}_{k},\boldsymbol{p} _{k}) - T(\boldsymbol{q}_{k - 1},\boldsymbol{p}_{k - 1})\), \(\Delta V = V(\boldsymbol{q}_{k}) - T(\boldsymbol{q}_{k - 1})\) and \(\Delta g = g( \boldsymbol{q}_{k}) - g(\boldsymbol{q}_{k - 1}) = 2\Delta \boldsymbol{q}^{T}\bar{\boldsymbol{q}}\). After that we can define the increment of the augmented Hamiltonian as follows:

$$ \Delta H_{\lambda } = \Delta H + \lambda \Delta g. $$
(55)

The energy–momentum preserving integration is constructed by setting \(\Delta H_{\lambda } = 0\). To this end, we first express \(\Delta V\) in terms of its finite derivative \(\partial V_{*} / \partial \boldsymbol{q}^{T}\), defined by [27]

$$ \Delta V = \Delta \boldsymbol{q}^{T}\frac{\partial V_{*}}{\partial \boldsymbol{q}^{T}}. $$
(56)

Substituting (22) and (56) into (54) yields

$$\begin{aligned} \Delta H &= \Delta \boldsymbol{p}^{T} \bigl( \boldsymbol{L}( \bar{\boldsymbol{q}})\boldsymbol{J}^{ - 1}\overline{ \boldsymbol{L}( \boldsymbol{q})^{T}\boldsymbol{p}} + \alpha ^{ - 1} \bar{\boldsymbol{q}}\overline{\boldsymbol{q}^{T} \boldsymbol{p}}\, \bigr) \\ &\quad{}+\Delta \boldsymbol{q}^{T} \bigl( \boldsymbol{L}(\bar{ \boldsymbol{p}}) \boldsymbol{J}^{ - 1}\overline{\boldsymbol{L}( \boldsymbol{p})^{T} \boldsymbol{q}} + \alpha ^{ - 1}\bar{ \boldsymbol{p}}\overline{ \boldsymbol{p}^{T}\boldsymbol{q}} + \partial V_{*} / \partial \boldsymbol{q}^{T} \bigr), \end{aligned}$$
(57)

where the overbar denotes the arithmetic mean, \(\overline{(\# )} = \frac{1}{2}[(\# )_{k - 1} + (\# )_{k}]\). According to (57), we can define the finite derivatives of \(H\) as

$$ \begin{aligned} \bar{\nabla }_{\boldsymbol{q}}H &= \boldsymbol{L}(\bar{\boldsymbol{q}}) \boldsymbol{J}^{ - 1}\overline{\boldsymbol{L}(\boldsymbol{q})^{T} \boldsymbol{p}} + \alpha ^{ - 1}\bar{\boldsymbol{q}}\overline{ \boldsymbol{q}^{T}\boldsymbol{p}}, \\ \bar{\nabla }_{\boldsymbol{p}}H &= \boldsymbol{L}(\bar{\boldsymbol{p}}) \boldsymbol{J}^{ - 1}\overline{\boldsymbol{L}(\boldsymbol{p})^{T} \boldsymbol{q}} + \alpha ^{ - 1}\bar{\boldsymbol{p}}\overline{ \boldsymbol{p}^{T}\boldsymbol{q}} + \partial V_{*} / \partial \boldsymbol{q} \end{aligned} $$
(58)

for the inertia representation of \(\alpha \)-type. Similarly, according to (26), we can define the finite derivatives of \(H\) as

$$ \begin{aligned} \bar{\nabla }_{\boldsymbol{q}}H &= \gamma ^{ - 1}\bar{\boldsymbol{p}} + \boldsymbol{L}(\bar{\boldsymbol{q}})\boldsymbol{J}_{\gamma }^{*}\overline{ \boldsymbol{L}(\boldsymbol{q})^{T}\boldsymbol{p}}, \\ \bar{\nabla }_{\boldsymbol{p}}H &= \boldsymbol{L}(\bar{\boldsymbol{p}}) \boldsymbol{J}_{\gamma }^{*}\overline{\boldsymbol{L}(\boldsymbol{p})^{T} \boldsymbol{q}} + \partial V_{*} / \partial \boldsymbol{q}, \end{aligned} $$
(59)

for the inertia representation of \(\gamma \)-type. Based on (58) or (59), Eq. (55) can be expressed as

$$ \Delta H_{\lambda } = \Delta \boldsymbol{p}^{T}\bar{\nabla }_{ \boldsymbol{q}}H + \Delta \boldsymbol{q}^{T}(\bar{\nabla }_{ \boldsymbol{p}}H + 2\lambda \bar{\boldsymbol{q}}). $$
(60)

Energy–momentum preserving scheme (EMS)

Let the increment\(\Delta H_{\lambda } = 0\), the discretized scheme is constructed as follows:

$$ \begin{aligned} \Delta \boldsymbol{q} / \Delta t &= \bar{\nabla }_{\boldsymbol{p}}H( \boldsymbol{q}_{k - 1},\boldsymbol{p}_{k - 1},\boldsymbol{q}_{k}, \boldsymbol{p}_{k}),\qquad 0 = g(\boldsymbol{q}_{k}), \\ \Delta \boldsymbol{p} / \Delta t &= - \bar{\nabla }_{\boldsymbol{q}}H( \boldsymbol{q}_{k - 1},\boldsymbol{p}_{k - 1},\boldsymbol{q}_{k}, \boldsymbol{p}_{k}) - 2\lambda \bar{\boldsymbol{q}}, \end{aligned} $$
(61)

where the unknowns\(\boldsymbol{q}_{k}\), \(\boldsymbol{p}_{k}\)and\(\lambda \)can be solved for the given\(\boldsymbol{q}_{k - 1}\)and\(\boldsymbol{p}_{k - 1}\). The schemes are abbreviated as EMS-\(\alpha \)and EMS-\(\gamma \)for the integrations of\(\alpha \)and\(\gamma \)-type, respectively.

EMS-\(\alpha \) is just the same as the energy–momentum conserving integration [11] for rigid body dynamics in terms of unit quaternions. The specific algorithms of IMS and EMS are summarized in pseudocode format in Appendix B.3.

4.2 Numerical integrations of higher order

Runge–Kutta methods form an important class of methods for the integration of differential equations. Recently, Jay [24] proposed the specialized partitioned additive Runge–Kutta (SPARK) methods for differential-algebraic equations (DAEs), which provide a straightforward way to construct conserving algorithms with an optimal order of convergence. Small [28] further presented the unified definition of the discontinuous collocation methods (Ref. [28], p. 64), which covers all SPARK methods of interest in this paper.

4.2.1 Discontinuous collocation type methods

Let \(c_{1},\ldots,c_{s}\) be distinct real numbers, \(\bar{c}_{1},\ldots, \bar{c}_{q}\) be distinct real numbers, and \(\tilde{c}_{0},\ldots, \tilde{c}_{p}\) also be distinct real numbers with \(\tilde{c}_{0} = 0\) and \(\tilde{c}_{p} = 1\). Consider the Hamilton system in (12) with the consistent initial values (\(\boldsymbol{q}_{k},\boldsymbol{p}_{k}\)) at \(t_{k}\) and the step-size \(\Delta t\), and we search for polynomials \(\boldsymbol{Q}(t)\) of degree \(s\), \(\boldsymbol{\varLambda } (t)\) of degree \(p\), \(\boldsymbol{P}^{f}(t)\) of degree \(q\), and \(\boldsymbol{P}^{r}(t)\) of degree \(p-1\) such that

$$ \begin{aligned} &\boldsymbol{Q}(t_{k}) = \boldsymbol{q}_{k},\qquad \boldsymbol{P}(t_{k}) = \boldsymbol{P}^{f}(t_{k}) + \boldsymbol{P}^{r}(t_{k}) , \\ &\boldsymbol{P}^{f}(t_{k}) = \boldsymbol{p}_{k} - \Delta t\tilde{b} _{0}\beta \hat{\boldsymbol{\delta}} (t_{k}),\qquad \boldsymbol{P}^{r}(t _{k}) = - \Delta t\tilde{b}_{0}\tilde{\boldsymbol{\delta}} (t_{k}) \end{aligned} $$
(62)

with the defects

$$ \hat{\boldsymbol{\delta}} (t) = \dot{\boldsymbol{P}}{}^{f}(t) + H_{ \boldsymbol{q}} \bigl(\boldsymbol{Q}(t), \boldsymbol{P}(t) \bigr),\qquad \tilde{ \boldsymbol{\delta}} (t) = \dot{\boldsymbol{P}}{}^{r}(t) + g _{\boldsymbol{q}} \bigl(\boldsymbol{Q}(t) \bigr)\boldsymbol{\varLambda } (t) $$
(63)

and satisfying the following conditions:

$$\begin{gathered} \dot{\boldsymbol{Q}}(t_{k} + c_{i}\Delta t) = H_{\boldsymbol{p}}\bigl( \boldsymbol{Q}(t_{k} + c_{i} \Delta t), \boldsymbol{P}(t_{k} + c_{i} \Delta t)\bigr), \quad i = 1,\ldots,s, \end{gathered}$$
(64)
$$\begin{gathered} \dot{\boldsymbol{P}}{}^{f}(t_{k} + \bar{c}_{i} \Delta t) = - H_{ \boldsymbol{q}}\bigl( \boldsymbol{Q}(t_{k} + \bar{c}_{i}\Delta t), \boldsymbol{P}(t_{k} + \bar{c}_{i}\Delta t)\bigr), \quad i = 1,\ldots,q, \end{gathered}$$
(65)
$$\begin{gathered} \dot{\boldsymbol{P}}{}^{r}(t_{k} + \tilde{c}_{i} \Delta t) = - g_{ \boldsymbol{q}}\bigl(\boldsymbol{Q}(t_{k} + \tilde{c}_{i}\Delta t)\bigr) \boldsymbol{\varLambda } (t_{k} + \tilde{c}_{i}\Delta t),\quad i = 1,\ldots,p - 1, \end{gathered}$$
(66)
$$\begin{gathered} \boldsymbol{P}(t) = \boldsymbol{P}^{f}(t) + \boldsymbol{P}^{r}(t), \end{gathered}$$
(67)
$$\begin{gathered} 0 = g\bigl(\boldsymbol{Q}(t_{k} + \tilde{c}_{i}\Delta t) \bigr),\quad i = 0,\ldots,p. \end{gathered}$$
(68)

If these polynomials exist, the numerical solution is defined by

$$ \begin{aligned} &\boldsymbol{q}_{k + 1} = \boldsymbol{Q}(t_{k} + \Delta t), \qquad \boldsymbol{p}_{k + 1} = \boldsymbol{P}(t_{k} + \Delta t) - \Delta t \tilde{b}_{p}\bigl(\beta \hat{\boldsymbol{ \delta}} (t_{k + 1}) + \tilde{\boldsymbol{\delta}} (t_{k + 1}) \bigr) , \\ &0 = g_{\boldsymbol{q}}(\boldsymbol{q}_{k + 1})H_{\boldsymbol{p}}( \boldsymbol{q}_{k + 1},\boldsymbol{p}_{k + 1}) . \end{aligned} $$
(69)

We take into consideration two types of Gauss SPARK methods, which can be constructed in the form of discontinuous collocation type methods with the following conditions.

s-stage Gauss–Lobatto SPARK methods (s-G-L)

Let\(\{ c_{i}\}\), \(i = 1,\ldots,s\), be the\(s\)nodes of the Gauss quadrature, \(p = s\), \(q = s\), \(\beta = 0\), \(\bar{c}_{i} = c_{i}\)for\(i = 1,\ldots, s\), and\(\{ \tilde{c}_{i}\}\), \(i = 0, 1,\ldots,s\)be the\(s + 1\)nodes of the Lobatto quadrature and then the discontinuous collocation methods (62)–(69) lead to the s-stage Gauss–Lobatto SPARK methods of order\(2s\). The schemes are abbreviated as G-L-\(\alpha \)and G-L-\(\gamma \)for the integrations of\(\alpha \)-type and\(\gamma \)-type, respectively.

s-stage Lobatto IIIA-B SPARK methods (s-LIIIA-B)

Let\(\{ c_{i}\}\), \(i = 1,\ldots,s\), be the\(s\)nodes of the Lobatto quadrature, \(q = s - 2\), \(p = s - 1\), \(\beta = 1\), \(\tilde{c}_{i - 1} = c_{i}\)and\(\bar{c}_{i - 1} = c_{i}\)for\(i = 2,\ldots,s - 1\), and then the discontinuous collocation methods (62)–(69) lead to the s-stage Lobatto IIIA-B SPARK methods of order\(2s-2\). The schemes are abbreviated as LIIIA-B-\(\alpha \)and LIIIA-B-\(\gamma \)for the integrations of\(\alpha \)-type and\(\gamma \)-type, respectively.

Table 1 lists the comparison between s-stage Gauss Lobatto method (s-G-L) and s-stage Lobatto IIIA-B method (s-LIIIA-B). It can be observed that s-G-L is of two orders higher convergence rate than s-LIIIA-B. These two Gauss SPARK methods are symmetric and symplectic methods proposed by Jay [24, 29]. In Appendix A, we present the unified formulations of SPARK methods and the corresponding Butcher style tableaux of SPARK coefficients for LIIIA-B (\(s = 2, 3\)) and G-L (\(s = 1, 2\)). The specific algorithms of the Gauss SPARK methods are summarized in pseudocode format in Appendix B.4.

Table 1 Comparison of s-stage Gauss–Lobatto and Lobatto IIIA-B methods

4.2.2 A geometric interpretation for Gauss SPARK methods

As illustrated in Fig. 1, the Gauss SPARK methods presented by (62)–(69) can be considered as a two-step projection process, where the abbreviations

$$ \begin{aligned} \boldsymbol{Q}_{i}& = \boldsymbol{Q}(t_{k} + c_{i}\Delta t),\qquad \bar{\boldsymbol{Q}}_{i} = \boldsymbol{Q}(t_{k} + \bar{c}_{i}\Delta t),\qquad \tilde{\boldsymbol{Q}}_{i} = \boldsymbol{Q}(t_{k} + \tilde{c}_{i} \Delta t), \\ \boldsymbol{P}_{i} &= \boldsymbol{P}(t_{k} + c_{i}\Delta t),\qquad \bar{\boldsymbol{Q}}_{i} = \boldsymbol{P}(t_{k} + \bar{c}_{i}\Delta t),\qquad \tilde{\boldsymbol{Q}}_{i} = \boldsymbol{P}(t_{k} + \tilde{c}_{i} \Delta t) \end{aligned} $$
(70)

are used to describe the physical quantities of the discrete points. In the first step, the mapping \(\boldsymbol{T}_{1}\) defined by the implicit functions (64), (65) and (68), gives the solutions of the intermediate variables \(\boldsymbol{Q}_{1},\ldots,\boldsymbol{Q}_{s}\), \(\boldsymbol{P} _{1},\ldots,\boldsymbol{P}_{s}\), and \(1,\ldots,\lambda _{p - 1}\). With these variables, \(\boldsymbol{q}_{k + 1}\), \(\boldsymbol{P}_{k + 1}\), and \(\dot{\boldsymbol{P}}_{k + 1}\) can be solved, serving as the input parameters in the next step. The mappings are denoted by \(\boldsymbol{T}_{1}(\alpha )\) and \(\boldsymbol{T}_{1}(\gamma )\) for the Hamilton’s equations of \(\alpha \)-type and \(\gamma \)-type, respectively. In the process of \(\boldsymbol{T}_{1}\) mapping, G-L and LIIIA-B methods use two different distributions of discrete points. More specifically, the discretized points \(\boldsymbol{Q}_{1},\ldots,\boldsymbol{Q}_{s}\) are mismatched with the constraint points \(\tilde{\boldsymbol{Q}}_{0},\ldots, \tilde{\boldsymbol{Q}}_{s}\) for s-G-L, as shown in Fig. 2(a). Hence \(\boldsymbol{Q}_{i}^{T}\boldsymbol{Q}_{i} \ne 1\), \(i = 1,\ldots,s\), during the simulation. According to (44), this means

$$ \boldsymbol{L}(\boldsymbol{Q}_{i})^{T}\boldsymbol{L}(\boldsymbol{Q} _{i}) + \boldsymbol{Q}_{i}\boldsymbol{Q}_{i}^{T} = \boldsymbol{I}_{4} + O(\delta \boldsymbol{Q}),\quad i = 1,\ldots,s, $$
(71)

where \(\delta \boldsymbol{Q}\) denotes the numerical error in a time step. Consequently, the mapping \(\boldsymbol{T}_{1}(\alpha )\) is not mathematically equivalent to \(\boldsymbol{T}_{1}(\gamma )\), and the discretization schemes of G-L methods are highly consistent with the assumption of the error analysis in Sect. 3.2. Contrary to s-G-L, s-LIIIA-B presents a collocated distribution between the discrete points \(\boldsymbol{Q}_{1},\ldots,\boldsymbol{Q}_{s}\) and constraint points \(\tilde{\boldsymbol{Q}}_{0},\ldots,\tilde{\boldsymbol{Q}}_{s}\), as illustrated in Fig. 2(b). Hence \(\boldsymbol{Q}_{i}^{T}\boldsymbol{Q} _{i} = 1\) for \(i = 1,\ldots,s\) is satisfied exactly for s-LIIIA-B during the simulation. This may render Condition (44) unsatisfied.

Fig. 1
figure 1

Gauss SPARK methods overview

Fig. 2
figure 2

The discrete scheme: (a) 2-stage-G-L, (b) 3-stage-LIIIA-B

In the second step, the mapping \(\boldsymbol{T}_{2}\) defined by the implicit function (69), gives the solutions of the quantities \(\boldsymbol{p}_{k + 1}\) and \(\lambda _{p}\). For s-G-L, the mapping \(\boldsymbol{T}_{2}\) which projects the value \(\boldsymbol{P}_{k + 1}\) onto the manifold \(\mathcal{M} = \{ \boldsymbol{p}^{T} \boldsymbol{q} = 0\}\) to obtain \(\boldsymbol{p}_{k + 1}\), has nothing to do with the parameter \(\alpha \) or \(\gamma \). Hence the parameters \(\alpha \) and \(\gamma \) influence the numerical performance of the integrators solely by the first step presented in Fig. 1. In contrast, s-LIIIA-B gives a mapping \(\boldsymbol{T}_{2}\) including the correction term

$$ \boldsymbol{\delta } (t_{k + 1}) = \dot{\boldsymbol{P}}(t_{k + 1}) + \partial T(\boldsymbol{Q}_{k + 1}) / \partial \boldsymbol{q}^{T} + \partial V(\boldsymbol{Q}_{k + 1}) / \partial \boldsymbol{q} + 2 \lambda \boldsymbol{Q}_{k + 1}. $$
(72)

\(\boldsymbol{T}_{2}\) not only preserves the path of the solution on the manifold ℳ but also recovers the convergence order of \(\boldsymbol{P}_{k + 1}\) from \(2s - 4\) to \(2s - 2\). Figure 3 gives a geometric interpretation of the correction term, and one can refer to Ref. [25] (pp. 35–38, 247–252) for the discussion in detail. In general, the term \(\partial T(\boldsymbol{Q}_{k + 1}) / \partial \boldsymbol{q}^{T}\)in (72) can be expanded as

$$ \partial T(\boldsymbol{Q}_{k + 1}) / \partial \boldsymbol{q}^{T} = \delta \nu (\boldsymbol{Q}_{k + 1},\boldsymbol{P}_{k + 1}) + \frac{1}{4}\boldsymbol{L}(\boldsymbol{P}_{k + 1})^{T}\boldsymbol{JL}( \boldsymbol{P}_{k + 1})\boldsymbol{Q}_{k + 1}, $$
(73)

where

$$ \delta \nu (\boldsymbol{Q}_{k + 1},\boldsymbol{P}_{k + 1}) = - \frac{1}{4}\gamma ^{ - 1}\boldsymbol{L}(\boldsymbol{P}_{k + 1})^{T} \boldsymbol{L}(\boldsymbol{P}_{k + 1})\boldsymbol{Q}_{k + 1} $$
(74)

for the Hamilton’s equations of \(\gamma \)-type, and

$$ \delta \nu (\boldsymbol{Q}_{k + 1},\boldsymbol{P}_{k + 1}) = \frac{1}{4}\alpha ^{ - 1}\boldsymbol{P}_{k + 1}\boldsymbol{P}_{k + 1} ^{T}\boldsymbol{Q}_{k + 1} $$
(75)

for the Hamilton equations of \(\alpha \)-type. Equation (74) can be reformulated as

$$ \delta \nu (\boldsymbol{Q}_{k + 1},\boldsymbol{P}_{k + 1}) = \frac{1}{8}\gamma ^{ - 1}\partial \bigl[\boldsymbol{P}_{k + 1}^{T} \bigl( \boldsymbol{I}_{4} - \boldsymbol{L}(\boldsymbol{Q}_{k + 1})^{T} \boldsymbol{L}(\boldsymbol{Q}_{k + 1})\bigr)\boldsymbol{P}_{k + 1} \bigr] / \partial \boldsymbol{Q}_{k + 1}^{T}. $$
(76)

Noting that \(\boldsymbol{Q}_{k + 1}^{T}\boldsymbol{Q}_{k + 1} = 1\)has been satisfied in the first step, we have

$$ \boldsymbol{I}_{4} - \boldsymbol{L}(\boldsymbol{Q}_{k + 1})^{T} \boldsymbol{L}(\boldsymbol{Q}_{k + 1}) = \boldsymbol{Q}_{k + 1} \boldsymbol{Q}_{k + 1}^{T}. $$
(77)

Substituting (77) into (76) and setting \(\gamma = \alpha \) lead to

$$ \delta \nu (\boldsymbol{Q}_{k + 1},\boldsymbol{P}_{k + 1}) = \frac{1}{8}\gamma ^{ - 1}\partial \bigl[\boldsymbol{P}_{k + 1}^{T} \boldsymbol{Q}_{k + 1}\boldsymbol{Q}_{k + 1}^{T}\boldsymbol{P}_{k + 1}\bigr] / \partial \boldsymbol{Q}_{k + 1}^{T} = \frac{1}{4}\alpha ^{ - 1}\boldsymbol{P}_{k + 1}\boldsymbol{P}_{k + 1}^{T}\boldsymbol{Q}_{k + 1} \biggm|_{\gamma = \alpha }. $$
(78)

Recall that the mappings are denoted by \(\boldsymbol{T}_{2}(\alpha )\) and \(\boldsymbol{T}_{2}(\gamma )\) respectively for the Hamilton’s equations of \(\alpha \)-type and \(\gamma \)-type. Equation (78) means the mapping \(\boldsymbol{T}_{2}(\gamma )\) is mathematical equivalent to \(\boldsymbol{T}_{2}(\alpha )\), and consequently \(\boldsymbol{p}_{k + 1}\) will be solved with the same numerical accuracy for s-LIIIA-B-\(\gamma \) and s-LIIIA-B-\(\alpha \) if \(\boldsymbol{q}_{k + 1}\), \(\boldsymbol{P}_{k + 1}\) and \(\dot{\boldsymbol{P}}_{k + 1}\) are assigned with the same inputs.

Fig. 3
figure 3

The discontinuous collocation for 3-stage LIIIA-B

Go back to the first step to reconsider the mapping \(\boldsymbol{T} _{1}\) for s-LIIIA-B. Although \(\partial T / \partial \boldsymbol{Q} _{i}\), \(i = 2,\ldots,s - 1\) and \(\partial T / \partial \boldsymbol{P} _{i}\), \(i = 1,\ldots,s\) are also involved in the mapping \(\boldsymbol{T} _{1}\) in this case, we must note that \(\boldsymbol{Q}_{i}^{T} \boldsymbol{Q}_{i} = 1\) for \(i = 1,\ldots,s\) is only satisfied implicitly, which means \(\boldsymbol{Q}_{i}^{T}\boldsymbol{Q}_{i} = 1\) is an iteration solution of the mapping \(\boldsymbol{T}_{1}\). Hence, we cannot present a straightforward and analytical way which is just like those presented by (76)–(78), to prove \(\boldsymbol{T}_{1}(\alpha ) = \boldsymbol{T}_{1}(\gamma )\). Nevertheless, the numerical testing in the next section would show that s-LIIIA-B-\(\alpha \) and s-LIIIA-B-\(\gamma \) are of the same numerical accuracy if \(\alpha \) and \(\gamma \) are assigned with the same value and this implies the equivalence between \(\boldsymbol{T}_{1}(\alpha )\) and \(\boldsymbol{T} _{1}(\gamma )\).

These differences presented above make G-L and LIIIA-B essentially two different methods in the numerical simulation, and we will further investigate the numerical performance of these methods in the following.

5 Numerical examples

In this section, numerical examples of a top spinning in gravitational field are considered. As shown in Fig. 4, the top fixed at \(O\) is rotating in a uniform gravitational field with the acceleration \(g =9.81\) in the negative \(z \)-direction. \(l\) represents the distance between the mass center \(A\) and the fixed point \(O\), and the rotational motion is expressed by the angle of nutation \(\theta \), the angle of precession \(\phi \), and the spin angle \(\psi \). The gravitational potential energy is written as [11, 16]

$$ V(\boldsymbol{q}) = mgl\cos \theta = mgl\boldsymbol{q}^{T} \boldsymbol{Kq}, $$
(79)

where \(\boldsymbol{K} = \operatorname{diag}(1, - 1, - 1, 1)\), and then we have \(\partial V(\boldsymbol{q}) / \partial \boldsymbol{q}^{T} = 2mgl \boldsymbol{Kq}\).

Fig. 4
figure 4

A heavy top

Two numerical examples are considered for comparing the numerical performance of different types of integrators in simulation, and the discussion would concentrate on the numerical influence of the parameters \(\alpha \) and \(\gamma \) in different inertia representations. The configuration parameters and initial conditions for the two examples are presented as follows.

Fast spinning top

The configuration parameters are corresponding to \(m =\)1, \(l =\)0.04 and the principal moments of inertia tensor with respect to the fixed point \([I_{1} = I_{2}, I_{3}] =[0.002, 0.0008]\). The following initial conditions are considered:

$$ [\phi _{0}, \theta _{0}, \psi _{0}] = [0, \pi / 6, 0],\qquad \boldsymbol{\varOmega }_{0}^{T} = [0, 0, 40\pi ]. $$
(80)

Correspondingly, the initial value \(\boldsymbol{q}_{0}\) and \(\boldsymbol{p}_{0}\) can be obtained by

$$\begin{aligned} \boldsymbol{q}_{0}^{T} = \biggl[&\cos \biggl( \frac{\phi _{0} + \psi _{0}}{2}\biggr)\cos \biggl(\frac{ \theta _{0}}{2}\biggr), \cos \biggl( \frac{\phi _{0} - \psi _{0}}{2}\biggr)\sin \biggl(\frac{ \theta _{0}}{2}\biggr), \\ &\sin \biggl( \frac{\phi _{0} - \psi _{0}}{2}\biggr)\sin \biggl(\frac{ \theta _{0}}{2}\biggr), \sin \biggl( \frac{\phi _{0} + \psi _{0}}{2}\biggr)\cos \biggl(\frac{ \theta _{0}}{2}\biggr)\biggr] \end{aligned}$$
(81)

and

$$ \boldsymbol{p}_{0} = 2\boldsymbol{L}(\boldsymbol{q}_{0})^{T} \boldsymbol{J\varOmega }_{0}. $$
(82)

Regular precession

The second example is the regular precession in gravitational field. The top is represented as a cone with the dimensions equivalent to those used in [17, 23]. The configuration parameters include the height \(h =0.1\), the radius \(r = \frac{1}{2}h\), the length \(l = \frac{3}{4}h\), and the mass \(m = \frac{1}{3}\rho \pi ^{2}h\) with the density \(\rho =\)2700. The three principal moments of the inertia matrix with respect to fixed point \(O\) are given by

$$ I_{1} = I_{2} = \frac{3}{5}m \bigl(r^{2}/4 + h^{2}\bigr),\qquad I_{3} = \frac{3}{10}mr ^{2}. $$
(83)

The initial conditions are as follows:

$$ [\phi _{0},\theta _{0}, \psi _{0}] = [0, \pi / 3, 0] $$
(84)

with a precession rate \(\dot{\phi } =\)10, and the velocity components \(\dot{\phi } \) and \(\dot{\psi } \) satisfying the relation

$$ \dot{\psi } = mgl / I_{3}\dot{\phi } + \frac{(I_{1} - I_{3})}{I_{3}} \dot{\phi } \cos (\theta ). $$
(85)

Correspondingly, the initial angular velocity vector can be obtained by

$$ \boldsymbol{\varOmega }_{0}^{T} = \bigl[0, \dot{\phi } \sin (\theta _{0}), \dot{\psi } + \dot{\phi } \cos (\theta _{0})\bigr]. $$
(86)

To precisely evaluate the numerical results among these integrators, we define the mean values of errors as follows:

$$\begin{gathered} E\bigl[|\Delta x_{\mathrm{c}}|\bigr] = \frac{1}{N_{t} + 1}\sum _{k = 0}^{N_{t}} | \Delta x_{\mathrm{c}, k}|,\qquad E\bigl[|\Delta z_{\mathrm{c}}|\bigr] = \frac{1}{N _{t} + 1}\sum _{k = 0}^{N_{t}} |\Delta z_{\mathrm{c}, k}|, \end{gathered}$$
(87)
$$\begin{gathered} E\bigl[|\Delta H|\bigr] = \frac{1}{N_{t} + 1}\sum _{k = 0}^{N_{t}} |\Delta H_{k}|, \end{gathered}$$
(88)
$$\begin{gathered} E\bigl[|\Delta l_{3}|\bigr] = \frac{1}{N_{t} + 1}\sum _{k = 0}^{N_{t}} |\Delta l _{3, k}|, \end{gathered}$$
(89)
$$\begin{gathered} E\bigl[|g(\boldsymbol{q})|\bigr] = \frac{1}{N_{t} + 1}\sum _{k = 0}^{N_{t}} \bigl| \boldsymbol{q}_{k}^{T}\boldsymbol{q}_{k} - 1\bigr|, \end{gathered}$$
(90)
$$\begin{gathered} E\bigl[\bigl|\boldsymbol{q}^{T}\boldsymbol{p}\bigr|\bigr] = \frac{1}{N_{t} + 1}\sum _{k = 0} ^{N_{t}} \bigl|\boldsymbol{q}_{k}^{T}\boldsymbol{p}_{k}\bigr|. \end{gathered}$$
(91)

In the above, \(N_{t}\) denotes the number of the total time steps; \(x_{\mathrm{c}}\) and \(z_{\mathrm{c}}\) denote the coordinates of mass center in \(x \)and \(z\)-directions, whose errors are denoted by \(\Delta x_{\mathrm{c},k}\) and \(\Delta z_{\mathrm{c},k}\) at the grid point \(t_{k} = k\Delta t\) (\(k = 0, 1,\ldots, N_{t}\)); \(\Delta H_{k}\) denotes the pointwise absolute energy error; \(\Delta l_{3,k}\) denotes the pointwise local angular momentum error of the \(l_{3}\)-component.

5.1 Conservation of invariants

Conservation of invariants (or termed conserved quantities) has important effects on the numerical performance of integrations. It has been suggested that numerical methods, who conserve invariants (especially quadratic invariants) automatically, tend to present good performance on long-time behavior in simulation [25]. In this paper, two different inertia representations and the corresponding parameters \(\gamma \) and \(\alpha \) are introduced when constructing the numerical integrations. It is interesting whether the introduction of the parameters in different inertia representations would destroy the conservation of invariants which has been held by numerical methods.

Tables 2 and 3 list the numerical results for the two examples, where the error terms \(E[|\Delta H|]\), \(E[|\Delta l_{3}|]\), \(E[|g( \boldsymbol{q})|]\) and \(E[|\boldsymbol{q}^{T}\boldsymbol{p}|]\) are defined by (88)–(91). Numerical integrations of \(\gamma \)-type and \(\alpha \)-type are both considered in the simulation. The errors are bolded if the invariants are conserved exactly by the integrations. We further show the numerical errors of the invariants (i.e., the total energy and the local angular momentum \(l_{3}\)) in Figs. 5 and 6 for IMS-\(\gamma \), EMS-\(\gamma \) and 3-LIIIA-B-\(\gamma \) for the first example. Figure 7 shows that \(\boldsymbol{q}^{T}\boldsymbol{p} = 0\) is not preserved exactly for IMS and EMS but presents a periodic error in simulation. We should emphasize that all these integrations present periodic errors if the invariants are not conserved exactly in the simulation. These numerical results suggest that the introduction of the parameter \(\gamma \) or \(\alpha \) does not destroy the conservation of an invariant as well as the good long-time behavior, which has been held automatically by the numerical methods.

Fig. 5
figure 5

Conservation of invariants for fast spinning top: (a) energy error of IMS-\(\gamma \), (b) energy error of EMS-\(\gamma \), (c) \(l_{3}\)-error of IMS-\(\gamma \), (d) \(l_{3}\)-error of EMS-\(\gamma \); \(\Delta t =0.01\), \(\gamma = \gamma _{\mathrm{m}}\)

Fig. 6
figure 6

Conservation of invariants for fast spinning top with 3-LIIIA-B-\(\gamma \): (a) energy error, (b) \(l_{3}\)-error, \(\Delta t=0.01\), \(\gamma = \gamma _{\mathrm{m}}\)

Fig. 7
figure 7

The orthogonal condition for fast spinning top: (a) \(\boldsymbol{q}^{T}\boldsymbol{p}\)-error for IMS-\(\gamma \), (b) \(\boldsymbol{q}^{T}\boldsymbol{p}\)-error for EMS-\(\gamma \), \(\Delta t = 0.01\), \(\gamma = \gamma _{\mathrm{m}}\)

Table 2 Conservation of invariants for fast spinning top, \(\gamma = \gamma _{\mathrm{m}}\), \(\alpha = 100\gamma _{\mathrm{m}}\), \(\Delta t = 0.001\), \(N_{t} = 4000\)
Table 3 Conservation of invariants for regular precession, \(\gamma = \gamma _{\mathrm{m}}\), \(\Delta t = 0.005\), \(N_{t} = 800\)

5.2 Comparison of the numerical accuracy

Tables 4, 5 and 6 list the numerical errors of the integrations for the two examples, where the error terms \(E[|\Delta H|]\), \(E[|\Delta z|]\) and \(E[|\Delta x|]\) are defined by (87) and (88). Numerical integrations of \(\gamma \)-type and \(\alpha \)-type are both considered. Figures 8 and 9 further show the numerical results of IMS-\(\alpha \)and IMS-\(\gamma \) for the two examples. It can be observed that all the integrations of \(\alpha \)-type are of the same numerical accuracy no matter what values are assigned to the parameter \(\alpha \); IMS-\(\gamma \), EMS-\(\gamma \) and 2-G-L-\(\gamma \) with \(\gamma = \gamma _{\mathrm{m}}\) are of much higher numerical accuracy than those of \(\alpha \)-type. These numerical results suggest that the parameter \(\gamma \) can be used to improve the numerical accuracy of numerical methods, whereas the parameter \(\alpha \) has no influence on the numerical accuracy of the integrations. Tables 46 further present that 3-LIIIA-B-\(\gamma \) is of the same numerical accuracy with 3-LIIIA-B-\(\alpha \) if \(\alpha \) and \(\gamma \) are assigned with the same values. According to the discussion in Sect. 4.2.2, numerical results suggest that \(\boldsymbol{T}_{1}( \alpha ) = \boldsymbol{T}_{1}(\gamma )\) for LIIIA-B, and there is no difference in accuracy between the two discretization schemes s-LIIIA-B-\(\alpha \) and s-LIIIA-B-\(\gamma \).

Fig. 8
figure 8

Trajectory error of mass center for fast spinning top: (a) \(x\)-component error, (b) \(z\)-component error; \(\Delta t = 0.01\); IMS-\(\gamma \) (×), \(\gamma = \gamma _{\mathrm{m}}\); IMS-\(\alpha \) (- - -), \(\alpha = \gamma _{\mathrm{m}}\); analytical (—)

Fig. 9
figure 9

Trajectory error of mass center for regular precession top: (a) \(x\)-component error, (b) \(z\)-component error; \(\Delta t = 0.007\); IMS-\(\gamma \) (×), \(\gamma = \gamma _{\mathrm{m}}\); IMS-\(\alpha \)(- - -), \(\alpha = \gamma _{\mathrm{m}}\); analytical (—)

Table 4 Fast spinning top: numerical accuracy for the integrations of \(\gamma \)-type, \(I_{3} = 0.0008\), \(\Delta t = 0.001\), \(N_{t} = 320\)
Table 5 Fast spinning top: numerical accuracy for the integrations of \(\alpha \)-type, \(I_{3} =0.0008\), \(\Delta t =0.001\), \(N_{t} =320\)
Table 6 Regular precession: numerical accuracy for integrations, \(r = \frac{1}{2}h\), \(\Delta t =0.005\), \(N_{t} = 80\)

In Table 6, besides \(\gamma _{\mathrm{m}}\) and \(\gamma _{\mathrm{h}}\), \(\gamma \) is also assigned with \(\tilde{\gamma }_{\mathrm{h}}\) to account for the large difference between \(I_{1}\) and \(I_{3}\) (i.e., \(I_{1} = I_{2} = 8.5I_{3}\)). It can be observed in Table 6 that IMS-\(\gamma \) and EMS-\(\gamma \) with \(\gamma = \gamma _{\mathrm{h}}\) have larger numerical errors than the others and the numerical accuracy is improved evidently if we use the corrected optimal value \(\tilde{\gamma }_{\mathrm{h}}\) presented in (50). We further change the radius by \(r = 1.5h\) for the example of regular precession which makes \(I_{1} = I_{2} = 1.39I_{3}\). It can be observed in Table 7 that the numerical accuracy of IMS-\(\gamma \) and EMS-\(\gamma \) assigned with \(\gamma = \gamma _{\mathrm{h}}\) is greatly improved, especially compared with those presented in Table 6. Recall the discussions in the last paragraph of Sect. 3.3, and these numerical results are highly consistent with those discussions.

Table 7 Regular precession: numerical accuracy for integrations, \(r = 1.5h\), \(\Delta t = 0.01\), \(N_{t} = 80\)

Figure 10 shows the relative error with time step increasing, where the error is obtained by evaluating the maximum of the relative error. These numerical results can be summarized as follows: IMS and EMS have the convergence of order 2; 2-G-L and 3-LIII-A-B have the convergence of order 4. It suggests that the convergence property keeps consistent regardless of whether the integrations are derived in \(\gamma \)-type or \(\alpha \)-type, and all the integrations of \(\gamma \)-type present higher accuracy than those of \(\alpha \)-type, except for 3-LIII-A-B.

Fig. 10
figure 10

Fast spinning top: the relative periodic error with time step increasing

The discussions and conclusions presented in Sects. 5.1 and 5.2 are also suitable to those SPARK methods of order 2, 6 or 8, although the numerical results are only listed for the cases of order 4. According to these numerical results, the inertia representation of \(\gamma \)-type can be used to improve the numerical accuracy of integrations without destroying the conservation of invariants. These results further suggest that the improvement of numerical accuracy can be achieved simultaneously for both the energy and trajectory by choosing a proper value of the parameter \(\gamma \). In addition, the integrations of \(\gamma \)-type with the proposed optimal values \(\gamma _{\mathrm{m}}\) and \(\gamma _{\mathrm{h}}\) can give impressively good numerical accuracy, especially compared with those of \(\alpha \)-type, and \(\gamma _{ \mathrm{m}}\) is more robust for IMS and EMS if there are large differences among the three principal moments.

5.3 Comparisons between the integrations of \(\gamma \) and \(\alpha \)-types

The conservation of invariant and the numerical accuracy of the integrations of \(\alpha \)-type and \(\gamma \)-type have been investigated in the above. Many other differences of numerical performance will be found if we consider the convergence orders, error-parameter relations, the discretization schemes and their combinations, as discussed in the following.

5.3.1 The error-parameter relations for IMS, EMS and G-L SPARK methods

Figures 11, 12 and 13 shows the linear relation between the periodic error and \(1/\gamma \) for IMS-\(\gamma \), EMS-\(\gamma \) and G-L-\(\gamma \) in the example of fast spinning top. Figure 13 further shows that the linear relation remains unchanged for G-L SPARK methods of \(\gamma \)-type when the order of the integration is changed. This implies that the error estimation discussed in Sect. 3.2 is probably independent of the order conditions. Figure 14 shows the relation between the periodic error and \(1 / \alpha \) for the example of the fast spinning top. It can be observed that the parameter \(\alpha \) has nearly no influence on the energy error for the integrations of \(\alpha \)-type. As referred to the discussion in Sect. 4.2.2, all three integrations IMS, EMS and G-L show the mismatch of the discretized points between the differential part and the algebraic part. We believe that this mismatch makes these results highly consistent with the error estimation in Sect. 3.2.

Fig. 11
figure 11

Energy error of IMS-\(\gamma \) for fast spinning top: (a) the periodic error-time curve, \(\Delta t = 0.001\), (b) the periodic error-\(1 / \gamma \) curve

Fig. 12
figure 12

Fast spinning top: the periodic error of \(l_{3}\)-angular momentum for EMS-\(\gamma \), \(\Delta t = 0.001\)

Fig. 13
figure 13

Periodic energy error with \(1 / \gamma \) increasing for fast spinning top: (a) 1-stage G-L-\(\gamma \), (b) 2-stage G-L-\(\gamma \), (c) 3-stage G-L-\(\gamma \), (d) 4-stage G-L-\(\gamma \)

Fig. 14
figure 14

Energy error changes with \(1 / \alpha \) for fast spinning top: (a) IMS-\(\alpha \), (b) EMS-\(\alpha \) (c) 2-stage G-L-\(\alpha \), (d) 3-stage G-L-\(\alpha \), (e) 4-stage G-L-\(\alpha \)

5.3.2 The error analysis for LIIIA-B SPARK methods

Figure 15 shows the periodic error of LIIIA-B-\(\gamma \) changing with \(1 / \gamma \) for the example of the fast spinning top. The figures of LIIIA-B-\(\alpha \)are not shown in this paper because s-LIIIA-B-\(\alpha \) presents exactly the same results as s-LIIIA-B-\(\gamma \). An interesting numerical phenomenon can be observed: the numerical errors are linear functions with \(1 / \gamma \) for 2-LIIIA-B and 4-LIIIA-B, whereas 3-LIIIA-B and 5-LIIIA-B present a logarithmic increasing (or decreasing) error-curve. Figure 16 further shows the convergence rate for the LIIIA-B SPARK methods. It presents that the parameter \(\gamma \) influences the numerical accuracy of 2-LIIIA-B and 4-LIIIA-B regardless of the size of the time step, and in contrast the influence of parameter \(\gamma \) declines rapidly for 3-LIIIA-B and 5-LIIIA-B with the time step decreasing.

Fig. 15
figure 15

Energy error changes with \(1 / \gamma \) increasing for fast spinning top: (a) \((2, 1)\)-LIIIA-B-\(\gamma \), (b\((3, 2)\)-LIIIA-B-\(\gamma \), (c) \((4, 3)\)-LIIIA-B-\(\gamma \), (d) \((5, 4)\)-LIIIA-B-\(\gamma \)

Fig. 16
figure 16

Fast spinning top: the periodic relative error with time step increasing for LIIIA-B

Although we predicted the mathematical equivalence of LIIIA-B-\(\alpha \) and LIIIA-B-\(\gamma \)in Sect. 4.2.2 and confirmed it by numerical results, the parameter \(\alpha \) or \(\gamma \) is not entirely useless for improving the numerical accuracy. Rather, it may somehow affect the integrations whose numbers of the stage are even, and we can still apply \(\gamma _{\mathrm{m}}\) and \(\gamma _{\mathrm{h}}\) to reduce the integration error, at least for even-stage schemes.

Though the results of 2-LIIIA-B and 4-LIIIA-B is preferable, the authors are not able to give an explanation to this phenomenon. Further work is needed to precisely study the role of parameters \(\alpha \) and \(\gamma \) for the LIIIA-B SPARK methods.

5.4 Robustness of the integrations with different parameters

Robustness of the parameters \(\gamma \) and \(\alpha \) is also discussed in this paper. The introduction of undetermined parameters to differential equations generally involves potential numerical risks if inappropriate values of the parameters are applied in the algorithm. Firstly, this may destroy the good long-time behavior, which has been discussed for the parameters \(\gamma \) and \(\alpha \) in Sect. 5.1. Secondly, an inappropriate value of the introduced parameter may cause an ill-conditioned problem of the iteration matrix, which means serious restriction of the time step to obtain a convergent result of Newton iteration.

Table 8 lists the maximum of the size of time-step (denoted as \(\Delta t_{\max } \)) to receive a convergent result of integrations for the example of the fast spinning top, where iter_max denotes the maximum number of iterations, \(\varepsilon _{r}\) denotes the maximum of the iteration error and \(N_{t}\) denotes the number of the total time steps. The Newton iteration stops and goes to the next time step if the iteration number is greater than the maximum iter_max or the iteration error is less than \(\varepsilon _{r}\). It can be observed that: IMS-\(\alpha \) and EMS-\(\alpha \) allow larger sizes of \(\Delta t_{\max } \) than IMS-\(\gamma \) and EMS-\(\gamma \); G-L-\(\gamma \) assigned with \(\gamma = \gamma _{\mathrm{m}}\) or \(\gamma _{\mathrm{h}}\) allows a larger size of \(\Delta t_{\max } \) than G-L-\(\alpha \); LIII A-B-\(\gamma \) assigned with \(\gamma = \gamma _{\mathrm{m}}\) or \(\gamma _{\mathrm{h}}\) allows a larger size of \(\Delta t_{\max } \) for \(s =3\), 4 and 5. Numerical results also suggest that 1-stage G-L-\(\alpha \) is divergent in simulation. It seems that \((1, 1)\)-G-L-\(\alpha \) suffers from serious morbidity of the iteration matrix, and plenty of numerical tests suggest that the energy error will increase linearly for 1-G-L-\(\alpha \) even if it is assigned with a very small size of time step.

Table 8 Fast spinning top: maximum of the time step for convergent results

Tables 9, 10, 11, 12, 13 and 14 list the mean values of iterations at which the iteration error becomes less than \(\varepsilon _{r}\) for IMS, EMS and LIII A-B. We select four different sizes of the time step to compare the convergent speeds of different integrations. It can be observed that the integrations of \(\gamma \)-type assigned with \(\gamma = \gamma _{ \mathrm{m}}\) generally have quicker convergence than those of \(\alpha \)-type. Table 9 shows that the iteration increases with decreasing size of the time step for IMS-\(\alpha \), which means much more computational cost compared with IMS-\(\gamma \). Tables 1114 shows that LIII A-B-\(\gamma \) assigned with \(\gamma = \gamma _{\mathrm{m}}\) or \(\gamma _{\mathrm{h}}\) has quicker convergence speed than LIII A-B-\(\alpha\). This means less computational cost for the integrations of \(\gamma \)-type. Although we have not listed the numerical results, the G-L methods present the same numerical features as the LIIIA-B methods.

Table 9 Fast spinning top: iteration number for IMS
Table 10 Fast spinning top: iteration number for EMS
Table 11 Fast spinning top: iteration number for 2-LIII A-B
Table 12 Fast spinning top: iteration number for 3-LIII A-B
Table 13 Fast spinning top: iteration number for 4-LIII A-B
Table 14 Fast spinning top: iteration number for 5-LIII A-B

These numerical results suggest that the numerical performance for the integrations of \(\gamma \)-type are harmonious between the numerical accuracy and stability, which means we can obtain higher numerical accuracy as well as better convergence speed by choosing the proper parameter (\(\gamma _{\mathrm{m}}\) or \(\gamma _{\mathrm{h}}\)). Although these tables only list the numerical results for the example of the fast spinning top, a large amount of numerical testing demonstrates that nearly the same numerical phenomenon can be observed for other configuration parameters or initial conditions.

6 Conclusion

The inertia representations of \(\gamma \)-type and \(\alpha \)-type have been developed for the simulation of the quaternion-based rigid body dynamics. The two inertia representations formally lead to different formulations of Hamilton’s equations, which are theoretically equivalent if the constraint \(\boldsymbol{q}^{T}\boldsymbol{q} = 1\) is satisfied exactly. However, error estimation demonstrates that the two kinds of inertia representations are different due to the discretization and suggests that the parameter \(\gamma \) can be used to optimize the numerical performance of the integrations in simulation.

The implicit midpoint scheme (IMS), the energy–momentum conserving scheme (EMS), and two types of Gauss SPARK methods (G-L and LIIIA-B) are derived to investigate the two inertia representations in simulations. The numerical results show that the parameters \(\alpha \) and \(\gamma \) can greatly influence the numerical performance of the integrations in simulation and the numerical influences are the result of the comprehensive effect of the discretization scheme, the inertia representations and their combinations. To be specific, IMS-\(\gamma \), EMS-\(\gamma \) and G-L-\(\gamma \) present a linear relation between numerical errors and the parameter \(\gamma \) regardless of the convergence order of the integration, whereas the parameter \(\alpha \) has no influence on the numerical accuracy for these integrations of \(\alpha \)-type; s-LIIIA-B-\(\alpha \)and s-LIIIA-B-\(\gamma \) are of the same numerical accuracy in simulation, if the parameters \(\alpha \) and \(\gamma \) are assigned with the same value; all the integrations of \(\gamma \)-type can present quicker convergence speed and better stability than those of \(\alpha \)-type. A large amount of numerical testing demonstrates that the two values \(\gamma _{ \mathrm{m}}\) and \(\gamma _{\mathrm{h}}\), referring to three principal moments, can be considered as two reasonable values of \(\gamma \), with which the integrations of \(\gamma \)-type can present better numerical accuracy, convergence speed and stability for these integrations.