Variational Integrators in Holonomic Mechanics

: Variational integrators for dynamic systems with holonomic constraints are proposed based on Hamilton’s principle. The variational principle is discretized by approximating the generalized coordinates and Lagrange multipliers by Lagrange polynomials, by approximating the integrals by quadrature rules. Meanwhile, constraint points are deﬁned in order to discrete the holonomic constraints. The functional of the variational principle is divided into two parts, i.e., the action of the unconstrained term and the constrained term and the actions of the unconstrained term and the constrained term are integrated separately using di ﬀ erent numerical quadrature rules. The inﬂuence of interpolation points, quadrature rule and constraint points on the accuracy of the algorithms is analyzed exhaustively. Properties of the proposed algorithms are investigated using examples. Numerical results show that the proposed algorithms have arbitrary high order, satisfy the holonomic constraints with high precision and provide good performance for long-time integration.


Introduction
Numerical integrators for nonlinear dynamic mechanics should reflect the properties of the underlying mechanical systems [1,2]. The characterization of symplectic integrators in terms of variational integrators has proven to be very fruitful. Compared with the traditional algorithms, the variational integrator has clear advantages, such as symplectic preserving, momentum preserving and excellent long-time behaviors [3][4][5].
Variational integrators are based on variational principles. The existence, uniqueness, regularity and other qualitative properties of variational problems have been well studied in appropriate function spaces [6,7]. Based on these studies, variational methods are widely used in mathematics, mechanics, physics, astronomy, economics and other fields of natural sciences and engineering. The theory of the discrete calculus of variations was originally formulated for optimal control problems [8][9][10] and gradually developed into the field of mechanics. Within the scope of discrete mechanics, the discrete Euler-Lagrange equations, the discrete Nother's theorem and the discrete action sum were clearly understood in [11][12][13], and these theories form the foundation of variational integrators. Using the idea of variational integrators, the Verlet method develops a series of algorithms. The SHAKE algorithm was first proposed by Ryckaert for molecular dynamics in [14] and is a constrained form of the Verlet algorithm. Another constrained version of the velocity Verlet integrator, called RATTLE, was proposed in [15] by Anderson and was later shown to be a symplectic integrator [16]. The Newmark method could be derived from variational integrators by choosing appropriate parameters, and an analysis of the symplecticity was given in [17]. The partitioned Runge-Kutta methods are a class of integrators that generalize the standard Runge-Kutta method. It has also been generalized to multi-symplectic partial differential equations, thus resulting in the multi-symplectic product partitioned Runge-Kutta methods [18]. The spectral and symplectic integrability analysis of the nonlinear dynamical systems are given by Blackmore [19]. Traditionally, variational integrators have been used to study conservative systems [20], but modern variational integrators have been developed for various problems, such as Hamiltonian systems [21,22], Lagrangian PDEs [23][24][25], non-holonomic systems [26][27][28] and forced and controlled systems [29][30][31][32]. By introducing suitable new variables and using integral representations, a dissipative system can be transformed into a system of conservative form; then, the Lagrangian of the associated system can be used to develop a variational integrator that inherits the advantageous properties of the conservative counterpart [33,34].
In recent years, high-order systems have received renewed interest due to new and relevant applications in optimal control for robotics and aeronautics and in the study of air traffic control and computational anatomy [35][36][37]. Galerkin variational integrators comprise a general method for constructing high-order variational integrators. They rely on the discretization of the action, which is then approximated by the finite-dimensional function space and a numerical quadrature rule. For unconstrained systems, the Galerkin variational integrator with the highest order is derived by using the Gauss-Legendre quadrature [5]. When using m degree polynomials for the approximation of the coordinates and the m points Gauss-Legendre quadrature rule, the order of this Galerkin variational integrator is s = 2m. Meanwhile, for the constrained system, the Galerkin variational integrator with the highest order is constructed by taking the Lobatto quadrature rule [5]. When using m degree polynomials for the approximation of the coordinates and the m points Lobatto quadrature rule, the order of this Galerkin variational integrator is s = 2m − 2.
It is fairly well known that, for a given number of points, the Gauss-Legendre rule has the highest order. However, according to the above discussion, the Gauss-Legendre rule is not used for the constrained system. Recently, a new kind of variational integrator for dynamic systems with holonomic constraints was constructed and analyzed in [38]. In this study, the augmented Lagrangian is split into two parts, which makes it possible to use the Gauss-Legendre quadrature rule for constrained systems. This practice not only improves the accuracy of the algorithm but also makes the construction of the algorithm more flexible. However, the quadrature points for the integral of the constrained term is still restricted to be part of the control points of the Lagrangian multipliers, and this makes it impossible to determine the effect of each factor on the accuracy of the algorithm. Evidently, clarifying the effect of each factor on the accuracy of the algorithm can provide a basis for constructing higher-precision algorithms. In our work, the augmented Lagrangian for constructing variational integrators follows [38]. However, in contrast to [38], the position of quadrature points used by two parts of the integral are both independent of the position of the control points. In this way, we put forward eight algorithms by choosing different types of control points and quadrature points. Based on these eight algorithms, the influence of control points and quadrature points on the accuracy of the algorithm is discussed in detail using numerical examples, and the effect of each factor on the accuracy of the algorithm is determined. This paper is structured as follows. In Section 2, we recall the basic definitions and concepts of constrained variational mechanics and variational integrators. In Section 3, a new construction of the Galerkin variational integrator for the constrained system is presented. In Section 4, the numerical properties are assessed using numerical examples and the influence of control points and quadrature points on the accuracy of the algorithm are discussed. Finally, a conclusion is given in Section 5.

Constrained Dynamics
In this section, a brief review of constrained dynamics is presented following [4]. Consider a mechanical system defined on the d dimensional configuration manifold Q with the corresponding tangent bundle TQ. Let q = q 1 , q 2 , · · · , q d T ∈ Q and . q = . q 1 , . q 2 , · · · , . q d T ∈ T q Q be the generalized coordinates and velocity of this system, respectively. Suppose that the system is constrained by c holonomic constraints: g(q) = g 1 (q), g 2 (q), · · · , g c (q) T = 0 (1) Then, the dynamic equation of motion for this system is given by q is the Lagrangian of the unconstrained system. The action of the constrained system in the time interval [0, T] is defined as and Hamilton's principle for Equations (2) and (3) can be given by If the generalized coordinates at times t = 0 and t = T are given, such as δq(0) = δq(T) = 0, then Hamilton's principle gives Equations (2) and (3).

Constrained Discrete Variational Dynamics
The concept of variational integrators is based on a discretization of the action. Consider a time grid ∆t = t k = kη k = 0, 1, · · · , N , Nη = T where N is a positive integer and η is the step size.
Replace the generalized coordinates q and Lagrange multipliers λ by the discrete curve q d = q k N k=0 and λ d = {λ k } N k=0 with q k = q d (t k ) and λ k = λ d (t k ) as approximations to q(t k ) and λ(t k ), respectively. The discrete augmented Lagrangian in interval [t k , t k+1 ] is defined as [38] (6) and for the entire time interval [0, T], the discrete action is defined as The variation of the discrete action is formulated by finding stationary points of the discrete action given by with δq 0 = δq N = 0. Performing the variational calculation gives where D i denotes the partial derivatives with respect to the i-th variables, respectively, such that Equations (9) and (11) provide a discrete iteration scheme for Equations (2) and (3) that determines q k+1 and λ k+1 for given q k−1 , q k , λ k−1 and λ k .

Galerkin Methods
To obtain accurate variational integrators, the discrete action should approximate the action over short intervals. One way to do this is to approximate the generalized coordinates and Lagrange multipliers via polynomials and approximate the integral via numerical quadrature rules. This approximation can be shown to be equivalent both to a class of continuous Galerkin methods and to a subset of symplectic partitioned Runge-Kutta methods [4].
The construction of our new algorithms falls within the framework of generalized Galerkin variational integrators, which were studied and analyzed in [4,[38][39][40][41]. In this section, we first provide a brief review of the generalized Galerkin variational integrators and two well-known algorithms in unconstrained systems. Then, they are generalized to the holonomic constrained systems. By comparing the order of the algorithms in the unconstrained and constrained systems, some contradictions inspire us to develop new algorithms for constrained systems.
For unconstrained systems, the exact discrete Lagrangian The motivating idea of the generalized Galerkin variational integrators is to replace the generally non-computable exact discrete Lagrangian L E d q 0 , q 1 with a highly accurate computable discrete analogue L d q 0 , q 1 . Specifically, given a Lagrangian L and t ∈ [0, η], the construction of a Galerkin variational integrator for unconstrained systems can be divided into two factors [39]:
In [5,39], the Galerkin variational integrators are based on the m points Gauss-Legendre quadrature rules, and choosing m + 1 equidistant points as the control points is shown to be equivalent to the collocation Gauss-Legendre method of order s = 2m. If the system is stiff, better numerical performance will result from using the m points Lobatto quadrature rule and m + 1 Lobatto points as the control points. The Galerkin variational integrator generated in this way has the order of s = 2m − 2.
The collocation of the Gauss-Legendre method and the Lobatto IIIA-IIIB partitioned Runge-Kutta method provides the best two methods for the unconstrained system. Now, we extend them into the holonomic constrained systems. Due to the existence of constraints given by Equation (1), the construction of a Galerkin variational integrator in constrained systems includes one more factor than in unconstrained systems, i.e.,

1.
Constraint points: Choose r + 1 constraint points 0 = a 0 < a 1 < · · · < a r−1 < a r = 1 so that Equation (1) can be accurately satisfied at time a i η, such that g(q(a i η)) = 0 for i = 0, 1, · · · , r. For constrained systems, Galerkin variational integrators based on the m points Lobatto quadrature rule with the choice of the m Lobatto points as the control points and constraint points is shown to be equivalent to the constrained Lobatto IIIA-IIIB partitioned Runge-Kutta method of order s = 2m − 2 [5,38], which is most widely used for constrained systems. However, at first glance, it seems natural to consider a Galerkin variational integrator based on the Gauss-Legendre quadrature rule, which has the highest order for a given number of quadrature points. Thus, we implemented this algorithm by using the m points Gauss-Legendre quadrature rule and equidistant points as the control points and constraint points. The order of the resulting algorithm is listed in Table 1, which shows that the order does not grow linearly as m increases, and it is far below s = 2m − 2. Table 1. Numerical convergence order of the algorithm using the m points Gauss-Legendre quadrature rule and m equidistant control points in constrained system. It is well known that, for a given number of quadrature points m, the order of the Gauss-Legendre quadrature rule and the Lobatto quadrature rule are 2m and 2m − 2, respectively. Based on the above discussion, it is clear that, in unconstrained systems, the order of the quadrature rules are completely preserved by the collocation of the Gauss-Legendre method and the Lobatto IIIA-IIIB partitioned Runge-Kutta method. However, in constrained systems, the algorithm with the Gauss-Legendre quadrature rule, which should have the highest order, does not achieve the order of 2m, and this inspires us to explore better algorithms for constrained systems.

New Construction of Galerkin Variational Integrators for Constrained Systems
Considering the first time interval [0, η], the generalized coordinates q i (t) and the Lagrange multipliers λ i (t) are approximated by the Lagrange polynomials of degree n that interpolate n + 1 control points at time d k η, (0 = d 0 < d 1 < · · · < d n−1 < d n = 1), i.e., in which Then, the generalized coordinate and Lagrange multiplier vectors can be written as in which Substituting the approximate generalized coordinates and Lagrange multipliers into Equation (4) gives where L d and g d denote the approximate actions of the unconstrained term and the constrained term, respectively. Since S d depends on variables q 0 0 , q 1 0 , · · · , q n 0 and λ 0 0 , λ 1 0 , · · · , λ n 0 , the total differential of S d is given by Taking q 0 0 and q n 0 as the independent variables, and using the theory of generating functions [5], the action S d satisfies the following equation: Comparing Equations (24) and (25), the partial derivative of S d with respect to q 0 0 , q 1 0 , · · · , q n 0 , gives and the partial derivative of S d with respect to λ 0 0 , λ 1 0 , · · · , λ n 0 , gives As mentioned in Section 3.1, the integrals of action S d will be approximated by numerical integrations. With integral points 0 ≤ c 1 < c 2 < · · · < c g−1 < c g ≤ 1 and weight b i , i = 1, 2, · · · , g, Equation (27) gives in which N i is the Lagrange polynomial obtained by Equation (19). When the position of the interpolation points of the Lagrange polynomials coincides with the position of the integral points c i , the Lagrange polynomial N i satisfies N i c j η = 0 for j i and N i c j η = 1 for j = i. Then, Equation (28) gives ∂g d In this condition, Equation (29) can be written as the following equation: When the position of the interpolation points of the Lagrange polynomials does not coincide with the position of the integral points, Equation (30) is still used to replace Equation (29) as it can ensure that the holonomic constraints precisely satisfied on the interpolation points. Moreover, Equation (27) includes (n + 1)c equations while Equation (30) includes nc equations, so that c additional equations are required for replacing Equation (27). Here, the velocity constraint at time t = η is used, i.e., Therefore, Equation (27) is replaced by Equations (30) and (31), in which Equation (30) precisely satisfies the holonomic constraints at control points and Equation (31) satisfies the velocity constraint at the terminal time of the subintervals. So far, the problem of solving holonomic constrained systems is transformed into solving Equations (26), (30) and (31). Let and define the Kronecker product of matrix A ∈ R k×l and B ∈ R s×t as the matrix Then, Equation (26) can be written as The variables q 0 0 and p 0 0 are known; thus, Equations (30), (31) and (35) include (n + 1)(d + c) equations that are dependent on (n + 1)(d + c) variables q, p n 0 andλ. In this paper, the Newton iteration method is used to solve these nonlinear algebraic equations. The Jacobi matrix Ψ of Equation (30), (31) and (35) with respect to variables q, p n 0 andλ can be given as a block matrix in which As mentioned in Section 3.1, the construction of a Galerkin variational integrator in a constrained system depends on three factors: control points, quadrature rules and constraint points. Combined with the construction process given in this section, it is clear that in Equations (30), (31) and (35), the approximation of the generalized coordinates and the Lagrange multipliers depends on the control points, the approximation of the integral depends on the quadrature rules, and the approximation of the holonomic constraint depends on the constraint points. Furthermore, from Equation (30), we can see that the position of the constraint point is actually determined by the control points. Therefore, different algorithms can be constructed by choosing different control points and quadrature rules.
In Section 3.1, we have discussed four Galerkin variational integrators: two for the unconstrained system and two for the constrained system. This shows that the variational integrators for the constrained system do not achieve the expected order. In our research, the variational integrator does not prevent the position of quadrature points from being the same as the position of the control points. This practice not only makes the construction more flexible and general but also makes it possible to determine the effect of quadrature points and control points on the accuracy of the algorithm. Evidently, clarifying the effect of each factor on the accuracy of the algorithm can provide a basis for constructing higher-precision algorithms. To do this, several new Galerkin variational integrators are implemented following the proposed procedure. Two kinds of control points are studied (equidistant control points and Lobatto control points), and two kinds of quadrature rules are studied (Gauss-Legendre quadrature and Lobatto quadrature). Furthermore, the approximate action in Equation (22) is divided into two parts that can be integrated independently. Therefore, we choose different quadrature rules for them to give insight into the quadrature rule. Then, eight algorithms can be constructed by choosing different control points and quadrature rules. The algorithms and their corresponding control points and quadrature rules are listed in Table 2. Based on the comparison and analysis of these algorithms, the influence factors are explored, providing the general notion for building a better algorithm for constrained systems.
If the order of an algorithm is s, the numerical error for time step η is Cη s , in which C is a constant. Thus, the errors e 1 and e 2 for two different time steps η 1 and η 2 can be given by

Example 1: The Nonlinear Spring Pendulum
Consider a dynamic system that consists of a nonlinear spring, a point particle A with mass m 1 , generalized coordinates (q 1 , q 2 ) and a pendulum B with mass m 2 , generalized coordinates (q 3 , q 4 ) and length l (see Figure 1). The point particle A slides without friction along a horizontal plane and point O is the equilibrium position. The Lagrangian and constraints are given by In this paper, m 1 = m 2 = l = g = 1 are used, and the initial conditions are given by In Sections 3.1 and 3.2, we stated that the construction of the algorithm depends on three factors: control points, quadrature rules and constraint points. Since the position of the constraint points and control points are the same, the actual factors are the control points and quadrature rules. We have constructed eight algorithms using different control points and quadrature rules. The influences of the control points and quadrature rule on the algorithm are studied by comparing the order and the global error of the algorithms.  To discover the influence of the control points on the algorithms, we divide eight algorithms into four groups. Group A includes ELL and LLL, group B includes EGL and LGL, group C includes ELG and LLG, and group D includes EGG and LGG. The two algorithms in the same group follow the same quadrature rule but different control points, since evidently the different precision between the two algorithms is determined by the type of control points. Figure 2 shows the log-log plot of the global error of the Hamiltonian during time 0 ∼ 400s, where rows (a)-(e) correspond to m = 2, 3, · · · , 6, respectively. The first column corresponds to group A, the second column corresponds to group B, the third column corresponds to group C, and the fourth column corresponds to group D. When m = 2 or 3, the equidistant points and Lobatto points are located on the same position, which means that the two algorithms in each group are constructed by the same quadrature rule and the same control points. That is, they are identical; thus, the two curves are coincidental in rows (a) and (b). When m > 3, the equidistant points and Lobatto points are not located on the same position anymore, and the differences of control points can lead to different precisions. By comparing the two algorithms of each group, we found that, for a given m, the algorithm using Lobatto control points always has a higher order than those that use equidistant control points.
The numerically determined order for the eight algorithms is summarized in Table 3. For the algorithms LGG, LGL, LLG and LLL that use Lobatto control points, their orders are s = 2m − 2. For the algorithms EGG, EGL, ELG and ELL that use equidistant control points, their order satisfies s = m, m is even m + 1, m is odd (53) Therefore, the Lobatto control points should be selected to obtain a higher order. Next, to assess the influence of the quadrature rules on the algorithm, LLL, LGL, LLG and LGG are further studied. Figure 3 shows the global errors of Hamiltonian of LLL, LGL, LLG and LGG for m = 2, 3, · · · , 6 and time step η = 0.1. Firstly, it shows that the global error of LGG is always better that LLL. This means that, when the control points are given, using the Gauss-Legendre quadrature rule for both the unconstrained term and the constrained term will achieve higher precision than using the Lobatto quadrature rule. Furthermore, the global errors of LLL and LGL are basically the same, as are the global errors of LLG and LGG. This outcome means that only changing the quadrature rule of the unconstrained term has little effect on the precision of the algorithms, and the influence of the quadrature rules on the precision of the algorithm is mainly through the constrained term.

Example 2: The Triple Pendulum
In this section, the triple pendulum is taken to reconfirm the conclusions in Section 4.2. The coordinate selection method of the triple pendulum is shown in Figure 4. The Lagrangian and constraints are given by The log-log plot of the global error of the triple pendulum is shown in Figure 5, which shows that algorithms using Lobatto control points have higher orders than those using equidistant control points. The comparison of the global error of Hamiltonian of LLL, LGL, LLG and LGG is given in Figure 6, which shows that LGG has the best precision between the three algorithms. In fact, several other examples are tested and verified, and the results agree well with the nonlinear spring pendulum and the triple pendulum.  In order to evaluate the computational efficiency, we made a comparison between our method and the constrained Lobatto IIIA-IIIB partitioned Runge-Kutta method. When the number of points is m, our method is a system of md + mc equations, while the constrained Lobatto IIIA-IIIB partitioned Runge-Kutta method is a system of 2md + (m − 2)c equations. As the dimension of generalized coordinates is generally greater than the number of holonomic constraints, i.e., d > c, the number of equations of our method is generally less than the constrained Lobatto IIIA-IIIB partitioned Runge-Kutta method. Meanwhile, according to [38], when choosing Lobatto points as control points and the Lobatto quadrature rule for both unconstrained item and constrained item, the associated algorithm LLL has the same precision as the constrained Lobatto IIIA-IIIB partitioned Runge-Kutta method. This means that, compared with the constrained Lobatto IIIA-IIIB partitioned Runge-Kutta method, algorithms LLG and LGG have higher precision while taking less computational time.

Example 2: The Triple Pendulum
In this section, the triple pendulum is taken to reconfirm the conclusions in Section 4.2. The coordinate selection method of the triple pendulum is shown in Figure 4. The Lagrangian and constraints are given by g(q) = (q 3 − L(sin q 1 + sin q 2 )) 2 + (q 4 − L(cos q 1 + cos q 2 )) 2 − L 2 = 0 (55)

Example 2: The Triple Pendulum
In this section, the triple pendulum is taken to reconfirm the conclusions in Section 4.2. The coordinate selection method of the triple pendulum is shown in Figure 4. The Lagrangian and constraints are given by The log-log plot of the global error of the triple pendulum is shown in Figure 5, which shows that algorithms using Lobatto control points have higher orders than those using equidistant control points. The comparison of the global error of Hamiltonian of LLL, LGL, LLG and LGG is given in Figure 6, which shows that LGG has the best precision between the three algorithms. In fact, several other examples are tested and verified, and the results agree well with the nonlinear spring pendulum and the triple pendulum.  In this paper, m 1 = m 2 = m 3 = L = g = 1 is used, and the initial conditions are given by The log-log plot of the global error of the triple pendulum is shown in Figure 5, which shows that algorithms using Lobatto control points have higher orders than those using equidistant control points. The comparison of the global error of Hamiltonian of LLL, LGL, LLG and LGG is given in Figure 6, which shows that LGG has the best precision between the three algorithms. In fact, several other examples are tested and verified, and the results agree well with the nonlinear spring pendulum and the triple pendulum.

Example 3: Six Balls
In this section, we show the long-time energy behaviors, the conservation of angular momentum and the structure-preserving properties through a numerical example.
Consider a system of six balls [16] with the configuration shown in Figure 7. The natural lengths of the springs and the lengths of the rigid bars are 1. The balls are numbered 1 to 6, and the number i-th ball has mass m i , generalized coordinates (x i , y i ) and momentum p ix , p iy . The Lagrangian and constraints are given by In this paper, the following initial condition is used: The symplectic algorithm has good long-time energy behavior. Figure 8 shows the energy error of LGG and LLL for m = 2, 3, · · · , 6 with a long-time duration of 0 ∼ 400s. It shows that the energy errors of both algorithms have definite upper and lower bounds and will not increase or decrease even after a long-time simulation.
For the six balls problem, the angular momentum is a conserved quantity based on the discrete Noether theorem for the constrained system [4]. Figure 9 shows the error of angular momentum of LGG with η = 1 and m = 2. It shows that the angular momentum attains numerical accuracy, even when using a large step and a low order. The variational integrator can inherit the specific properties of the underlying mechanical system. The trajectory of the six balls is shown in Figure 10 as simulated by LGG during the time 300 ∼ 400s with m = 2 and time step η = 0.1, which shows that antisymmetric is an inherent property of this system. For example, considering ball 1 and ball 6, due to their antisymmetric property, their generalized coordinates satisfy in which C 1 and C 2 are constant. Figure 11 shows the value of Equation (61) during the time 0 ∼ 400s as simulated by LGG. It shows that, even after long-time simulations, the antisymmetric property is still perfectly conserved.

Example 3: Six Balls
In this section, we show the long-time energy behaviors, the conservation of angular momentum and the structure-preserving properties through a numerical example.
Consider a system of six balls [16] with the configuration shown in Figure 7. The natural lengths of the springs and the lengths of the rigid bars are 1. The balls are numbered 1 to 6, and the In this paper, the following initial condition is used: 1 2  3  2 1  3  3  3  2  2  0 , , , 1, 0, , 2, 0, 2 , The symplectic algorithm has good long-time energy behavior. Figure 8 shows the energy error of LGG and LLL for 2, 3, , 6 m =  with a long-time duration of 0 400s  . It shows that the energy errors of both algorithms have definite upper and lower bounds and will not increase or decrease even after a long-time simulation.  momentum and the structure-preserving properties through a numerical example.
Consider a system of six balls [16] with the configuration shown in Figure 7. The natural lengths of the springs and the lengths of the rigid bars are 1. The balls are numbered 1 to 6, and the number i-th ball has mass i m , generalized coordinates ( ) In this paper, the following initial condition is used: 1 2  3  2 1  3  3  3  2  2  0 , , , 1, 0, , 2, 0, 2 , The symplectic algorithm has good long-time energy behavior. Figure 8 shows the energy error of LGG and LLL for 2, 3, , 6 m =  with a long-time duration of 0 400s  . It shows that the energy errors of both algorithms have definite upper and lower bounds and will not increase or decrease even after a long-time simulation.
is a conserved quantity based on the discrete Noether theorem for the constrained system [4]. Figure 9 shows the error of angular momentum of LGG with 1 η = and 2 m = . It shows that the angular momentum attains numerical accuracy, even when using a large step and a low order.  The variational integrator can inherit the specific properties of the underlying mechanical system. The trajectory of the six balls is shown in Figure 10 as simulated by LGG during the time 300 400s  with 2 m = and time step 0.1 η = , which shows that antisymmetric is an inherent property of this system. For example, considering ball 1 and ball 6, due to their antisymmetric property, their generalized coordinates satisfy in which 1 C and 2 C are constant. Figure 11 shows the value of Equation (61) during the time 0 400s  as simulated by LGG. It shows that, even after long-time simulations, the antisymmetric property is still perfectly conserved.

Conclusions
New variational integrators for dynamics with holonomic constraints are proposed in this paper based on the Galerkin variational integrators. The augmented Lagrangian is split into two parts, the position of quadrature points used by two parts of the integral are both independent of the position of the control points. Then, eight algorithms are practically constructed using different control points and quadrature rules. Based on these eight algorithms, the influence of control points and quadrature points on the accuracy of the algorithm is discussed in detail using numerical examples. Firstly, the numerical results show that the type of control point will influence the order of the algorithms, i.e., using Lobatto control points will achieve a higher order than using equidistant control points. The order obtained by the Lobatto control points is s = 2m − 2, and the order of the equidistant control points follows Equation (53). On the other hand, quadrature rules will influence the global error of the algorithms: using Gauss-Legendre quadrature rules will achieve better precision than using Lobatto quadrature rules, and the influence of quadrature rules on the precision of the algorithm is mainly through the constrained term.

Conflicts of Interest:
The authors declare no conflict of interest.