Generalized variational calculus for continuous and discrete mechanical systems

In this paper, we consider a generalization of variational calculus which allows us to consider in the same framework different cases of mechanical systems, for instance, Lagrangian mechanics, Hamiltonian mechanics, systems subjected to constraints, optimal control theory and so on. This generalized variational calculus is based on two main notions: the tangent lift of curves and the notion of complete lift of a vector field. Both concepts are also adapted for the case of skew-symmetric algebroids, therefore, our formalism easily extends to the case of Lie algebroids and nonholonomic systems. Hence, this framework automatically includes reduced mechanical systems subjected or not to constraints. Finally, we show that our formalism can be used to tackle the case of discrete mechanics, including reduced systems, systems subjected to constraints and discrete optimal control theory.


Introduction
The main objective of classical mechanics is to seek for trajectories describing the motion of mechanical systems and its properties. It is well-known that there exists a variational procedure to obtain these trajectories for many cases of interest. Hamilton's variational principle singles out particular curves q : [t 0 , t 1 ] → R by δ t 1 t 0 L(q(t),q(t)) dt = 0 , where the variation is over curves joining two fixed points. A basic result of calculus of variations is that Hamilton's variational principle (see [1]) holds for a curve q(t) if and only if the curve satisfies the Euler-Lagrange equations: The variational derivation of the equations of motion are extended to many systems of interest; for instance, in the dynamic of systems associated with Lie groups, one can derive the Euler-Poincaré equations which occur for many systems; e.g., rigid body equations, equations of fluids and plasma dynamics [19,20]. For other systems, as an spacecraft with movable internal parts, one can combine Euler-Poincaré and Euler-Lagrange equations, both derive from appropriate variational procedures. In this paper, we explore the common features of all these systems obtaining a generalized variational derivation of the equations of motion. Our method is valid for a wide class of mechanical systems including Lagrangian and Hamiltonian mechanics, variational systems with constraints, nonholonomic systems and reduced systems. Moreover, the techniques are easily adapted for the case of discrete mechanics. More specifically, we define a generalized variational problem on T Q only determining a submanifold Σ of T * T Q where Q stands for the configuration space of a mechanical system. Then, using the notions of tangent lift of curves and vector fields (see Section 2 for more details), we extend Hamilton's variational principle in the following way: a solution of a generalized variational problem determined by Σ ⊂ T * T Q is a curve σ : I → Q such that (1.1) I µ(t), X T (t,σ(t)) dt = 0, where µ is a curve in the submanifold Σ which projects over σ, and X T is the tangent lift to T Q of an arbitrary time-dependent vector field on Q.
We will show that these generalized variational problems accomplishe a great number of systems of interest in mechanics. Additionally, since our approach is intrinsic, we may derive the corresponding Hamel's formalism where the velocity components are measured relative to a set of independent vector fields on the configuration space Q not generally associated with configuration coordinates. Moreover, it is possible to substitute the tangent bundle by another space which admits the lifting operations necessary for our definition of generalized variational calculus. One example of this type of spaces is precisely skew-symmetric algebroids which allows us to define the corresponding equations of motion. With the general framework of skew-symmetric algebroids, we derive the equations for interesting type of mechanical systems: Euler-Poincaré equations, Lie-Poisson equations, Lagrange-Poincaré equations, equations for nonholonomic systems, higher-order lagrangian mechanics and so on. These applications for continuous lagrangian systems were studied previously in [16] where the authors develop a variational calculus adapted to skewsymmetric algebroids, finding the equations for lagrangian systems in this setting and also for the case of systems subjected to different type of constraints (nonholonomic or vakonomic). In this paper, we analyze the underlying geometry of infinitesimal variational calculus allowing new and interesting applications as, for instance, discrete mechanics. Moreover, our formalism follows the same philosophy of the classical approach to variational calculus using exterior differential systems, i.e., Griffiths formalism, in which it is given a subbundle I of the cotangent bundle T * M of a manifold M and a 1-form ϕ on M . The subbundle I determines the set curves σ : I → M such that σ * (I) = 0 (integral curves of I) and the formalism studies the extremals of the functional J(σ) = σ ϕ (see also [18,21]).
In the case of discrete mechanics, we will start with a submanifold Σ d of T * Q × T * Q ≡ T * (Q × Q) and, using an appropriate discrete tangent lift of vector fields (see Section 4 for more details) and discrete curves, we extend the discrete Hamilton's variational principle (see [32]). In this extension, we consider as solutions of the discrete generalized variational problem determined by Σ d , the discrete curves σ : Z → Q such that there exists a curve µ : Z → Σ d ⊂ T * (Q × Q) which projects over the curveσ(k) = (σ(k), σ(k + 1)) ∈ Q × Q and, for all Z-dependent section X : Z × Q → T Q, N −1 k=0 µ(q k , q k+1 ), X T (k, q k , q k+1 ) = 0 holds.
We will see that this description is flexible enough to cover the most important cases of discrete variational calculus, also with constraints, and even to be defined on Lie groupoids (see [29,40] and references therein).
For a better understanding of our methods, we will start with the two more familiar cases of tangent bundles; namely, the continuous case and the cartesian product of two copies of the configuration space (the discrete setting). Then, we will move to the case of mechanics on skew-symmetric algebroids and Lie groupoids, showing that the techniques are quite similar to the standard cases.
The paper is structured as follows. x ∈ Q, we can introduce the notion of curve at x as a curve γ : I −→ Q such that I ⊆ R contains 0 in its interior and γ(0) = x. Then, we say that two curves γ 1 and γ 2 at x are equivalent if, for any coordinate chart (U, ϕ) with x ∈ U, we have that

Contents
. Therefore, with this definition, it is possible to introduce an equivalence relation of curves at x and define a tangent vector v x as an equivalence class v x = [γ] (1) x . The collection of all equivalence classes defines the tangent space T x Q. The tangent bundle is precisely the disjoint union of tangent spaces T Q = x∈M T x Q equipped with a natural structure of vector bundle. We denote by τ T Q : Its dual vector bundle is the cotangent bundle T * Q with projection π T Q : T * Q → Q (for more details, see [1,12]). Similarly, it is also possible to define the second-order tangent bundle T (2) Q taking equivalence classes of curves γ 1 and γ 2 at x where dγ 1 dt (0) = dγ 2 dt (0) and d 2 γ 1 dt 2 (0) = d 2 γ 2 dt 2 (0). In general, one can define higher-order tangent bundles using this procedure, see [11]. We alternatively denote by [γ] (2) x or a x the corresponding equivalence class in T (2) Q. We have induced coordinates (q i ,q i ,q i ) in T (2) Q. In this case, we consider the canonical immersion (1) is the lift of the curve γ to T Q and γ (1) x where γ t (s) = γ(t + s). In local coordinates Given a map f : Q 1 → Q 2 between two manifolds, we have the tangent map T f ≡ f * : (1) f (x) . Based on this tangent lift of a map, there exists a canonical lift of a curve on Q to a curve on the tangent bundle T Q. In fact, if we have a curve σ : I → Q, we define the tangent lift of σ asσ ≡ dσ dt : In coordinates, if σ(t) = (q i (t)), thenσ(t) = (q i (t),q i (t)).
Another important geometric ingredient that we will need for our definition of generalized variational calculus is the notion of complete lift of a vector field. Remember that a vector field X is a smooth section of τ T Q : T Q → Q, that is, X ∈ Γ(τ T Q ) ≡ X(Q). Expressed in terms of the coordinate frame {∂/∂q i }, we have that We denote by {Φ X t } the flow of X. The most natural definition of the complete lift X c of X is given in terms of its flow. We say that X c is the vector field on T Q with flow In other words, In the standard coordinate frame {∂/∂q i , ∂/∂q i }, we have that Schematically, In our approach, we will need an alternative characterization of the complete lift. Then, recall first that a linear function on the vector bundle τ T Q : T Q → Q is identified to a section of the dual bundle π T Q : T * Q → Q. More precisely, if β ∈ Γ(π T Q ) (that is, β is a 1-form), then we define the linear functionβ : for all v x ∈ T Q. Then, an alternative characterization of the complete lift will be the following.
Proposition 2.1. The complete lift X c of a vector field on Q is the unique vector field on T Q such that verifies the following two conditions: (i) X c is projectable over X by means of (τ T Q ) * , that is, (τ T Q ) * X c = X.
(ii) X c (α) = L X α, for all α ∈ Γ(π T Q ). Here, L X α ∈ Γ(π T Q ) denotes the Lie derivative of α with respect to X, that is, An interesting remark is about the choice of a frame to locally write the complete lift of a vector field. In (2.1), we have used the standard frame but, in some cases, it is interesting to use a different one. Let us assume that we have fixed coordinates (q i ) in Q and an arbitrary frame {Y i } (a nonholonomic or moving frame, following different authors) where Then, a vector field X ∈ X(Q) has the following local expressions Moreover, the new frame induces a new system of coordinates for any v x ∈ T Q. Using Proposition 2.1 or by a change of coordinates, it is not hard to prove that the complete lift X c can be rewritten as Another notion that will be used later is the vertical lift of a vector field on Q to T Q. Let X ∈ X(Q), the vertical lift of X is the vector field on T Q defined by: Locally, or, in the frame {Y i }, we have that An alternative definition of vertical lift is the following: Proposition 2.2. The vertical lift X v of a vector field X is the unique vector field on T Q verifying the following conditions: For our study we need to deal with time-dependent vector fields and the notion of their tangent lifts.
A time-dependent vector field X is a smooth mapping X : I × Q → T Q, for I ⊆ R, such that X(t, x) ∈ T x Q. We denote the set of time-dependent vector fields by X(pr Q ) where pr Q : I × Q → Q. Definition 2.3. The tangent lift X T of a time-dependent vector field X on Q is the unique time-dependent vector field on T Q verifying the following two conditions: , for all α ∈ Γ(π T Q ). Here, X(t, x) = X t (x) = X x (t). Schematically, Similarly, we can introduce the vertical lift X V of a time-dependent vector field X ∈ X(pr Q ) as where X t is the vector field on Q defined by X t (x) = X(t, x).
In canonical coordinates X V = X i (t, q) ∂ ∂q i or, in the nonholonomic frame, X V = X j (t, q) ∂ ∂y j . Also, we define the total derivative of a function f : R × Q → R as the function Locally, we have that In the same way, if F : R×T Q → R, its total derivative is the function dF dt : Locally, we can write The following definition will play an important role in the sequel.
Definition 2.4. The Euler-Lagrange operator associated with a 1-form µ ∈ Γ(π T Q ) = Λ 1 (T Q) is the mapping E µ : for any X ∈ X(Q). This is well defined since the definition of the Euler-Lagrange operator only depends on the point Observe that if X ∈ X(pr Q ), we have that For a function L : T Q → R, or, in an arbitrary frame {Y i }, for an element X =X i Y i ∈ X(pr Q ) we have that

2.2.
Generalized variational problem on the tangent bundle.
Definition 2.5. A generalized variational problem on T Q is determined by a submanifold Σ of T * T Q. We initially assume the submanifold property for simplicity since in general Σ could be any subset of T * T Q. Definition 2.6. A solution of the generalized variational problem determined by Σ ⊂ T * T Q is a smooth curve σ : I → Q such that there exists another curve µ : I → Σ verifying π T T Q (µ(t)) =σ(t) and, for all time-dependent vector field X ∈ X(pr Q ), (2.6) I µ(t), X T (t,σ(t)) dt = 0.
It is generically difficult to obtain useful characterizations of equations (2.9), but we will see in the next subsections that for particular choices of Σ, we will derive the equations of motion of many mechanical systems of interest.
2.3. Lagrangian mechanics. Given a Lagrangian function L : T Q → R, we know that the classical Euler-Lagrange equations for L are derived using variational principles (see for instance [1]). Of course, our generalized variational calculus is equivalent to the classical derivation using standard variational techniques. In this particular case, we have that Σ = Im(dL) = dL(T Q) and C = T Q. Observe that Σ is a Lagrangian submanifold of T * T Q equipped with the canonical symplectic 2-form ω T Q . So we look for a curve we also assume that X(t 0 , σ(t 0 )) = X(t 1 , σ(t 1 )) = 0. In this case, µ(t) = dL(σ(t)). Using Equation (2.2) we deduce that Therefore, the equations of motion of Lagrangian mechanics are Locally, in the coordinate frame, we obtain the classical Euler-Lagrange equations In the frame {Y i }, Y i ∈ X(Q) for 1 ≤ i ≤ n, we derive another representation of the Euler-Lagrange equations: the Hamel equations (see equation 2.7)

Hamiltonian mechanics.
Let H : T * Q → R be a Hamiltonian function. We will show that the typical Hamilton equations for H are also expressed as a generalized variational problem. First, we will use the canonical antisymplectomorphism R between (T * T * Q, ω T * Q ) and (T * T Q, ω T Q ) (see references [16,28] and references therein), that in local coordinates is given by R(q, p, µ q , µ p ) = (q, µ p , −µ q , p).
Taking the submanifold dH(T * Q) = Im(dH) of T * T * Q and using R, we construct the submanifold Σ H = R(dH(T * Q)) of T * T Q. In local coordinates we can write Given such a Σ H , we have the following definition.
and, for all X ∈ X(pr Q ), Locally, the curve µ : . Therefore, the equations of motion derived from Σ H are: ). Both equations are the typical Hamilton's equations for H : T * Q → R.

Constrained variational calculus.
In this secton, we study the case of variational constrained calculus, also called vakonomic mechanics (see references [5,8,9,16,41]). The equations are derived using purely variational techniques. We will see how to define a submanifold of T * T Q to reproduce these classical equations using the generalized variational calculus. From a geometrical point of view, these type of variationally constrained problems are determined by a pair (C, l) where C is a submanifold of T Q, with inclusion i C : C ֒→ T Q, and l : C → R a Lagrangian function defined only along C. So we can define It is easy to show that Σ l is a Lagrangian submanifold of (T * T Q, ω T Q ) (see [38]). Alternatively, we can write Σ l as with some abuse of notation. Here, L : T Q → R is an arbitrary extension of l to T Q (that is l • i C = L) and ν * (C) is the conormal bundle of C: Therefore a curve µ : [t 0 , t 1 ] → Σ l will be written as Then, the equations of motion of the constrained variational problem are where a solution is a pair (σ, ν) with σ : Working locally, assume that we have fixed local constraints such that they determine C by their vanishing, i.e., φ α (q,q for some Lagrange multipliers λ α , to be determined. Then Equations (2.10) and (2.11) are now rewritten as which are the equations of motion for a constrained variational problem. Choosing an arbitrary frame {Y i } instead of the standard coordinate one, we immediately deduce that the equations of motion for the constrained variational problem arė ). An alternative way to describe the equations of motion in this case is related with the description Σ l = {µ ∈ T * T Q | i * C µ = dl}, where we assume that the constraint functions are locally expressed as follows: ) and, if we take an arbitrary 1-form Since i * C µ = dl, then Observe that we are naturally describing Σ l with coordinates (q i ,q a ,μ α ). Thus, applying the generalized variational calculus to Σ l , we arrive to an alternative but equivalent description of the constrained variational calculus by the equation from which we easily derive the equations These equations are obtained in [9] using variational techniques and introducing an ansatz in the deduction that now is clarified in the context of the generalized variational calculus.
In coordinates (q i , y i ), assuming that the constraint submanifold C is locally given by the vanishing of the constraints y α = Φ α (q i , y a ), we have i C : C ֒→ T Q given by i C (q i , y a ) = (q i , y a , Φ α (q i , y a )) and we take From (2.4) we have that the equations of the generalized variational calculus in this case are Then, using the expression forμ i and y j , we obtain the following system of equations for vakonomic mechanics These equations coincide with the ones derived in [24].
2.5.1. Sub-Riemannian geometry. Sub-Riemannian geometry is a generalization of Riemannian geometric where the Riemannian metric is only defined on a vector subbundle of the tangent bundle to the manifold, instead on the full manifold. The notion of length is only assigned to a particular subclass of curves, that is, curves with tangent vectors belonging to the vector subbundle for each point. More precisely, we consider a manifold Q equipped with a smooth distribution D of constant rank. A sub-Riemannian metric on D consists of a positive definite quadratic form g q on D q smoothly varying in q ∈ Q. We will say that a piecewise smooth curve σ : . We define its length as follows From this definition, we have a notion of distance between two points x, y ∈ Q as dist (x, y) = inf σ lenght(σ). It is finite if there exists admissible curves σ connecting x and y; in another case, the distance is considered infinite. A curve which realizes the distance between two points is called a minimizing sub-Riemannian geodesic. It is clear that the problem of finding minimizing sub-Riemannian geodesics is exactly the same as the vakonomic problem determined by the restricted Lagrangian l : Now, we will see a particular example of sub-Riemannian geometry. We consider a local sub-Riemannian problem given by (U, D, g), where U is an open set in R 3 contai- and q = (q 1 , q 2 , q 3 ) are the coordinates. The sub-Riemannian metric g is defined on D by a(q)d(q 1 ) 2 + 2b(q)dq 1 dq 2 + c(q)d(q 2 ) 2 but, for simplicity, we assume that a(q) = 1, b(q) = 0 and c(q) = 1/2. So, in our notation, If we consider the adapted basis ∂ ∂q 3 of vector fields on Q, we induce coordinates {y 1 , y 2 , y 3 } where now C is determined by the constraint y 3 = 0. In this case, we obtain that C 3 12 These equations coincide with the ones obtained in [7].
Remark 2.8. It is interesting to note that our formalism is also adapted to the study of abnormal solutions of sub-Riemannian geometry (see [36]). For a complete study of regular and normal solutions, it is only necessary to consider the subset Σ = Σ l ∪ ν * (D). ⋄

2.5.2.
Higher-order Lagrangian systems. In the case in which we have a higher-order Lagrangian L : T (k) Q → R, that is, a Lagrangian depending on higher-order derivatives (positions, velocities, acelerations and so on), we can also apply the generalized variational calculus. As in Section 2.1, we know that we can see T (k) Q as a submanifold of T T (k−1) Q, using the inclusion j k : T (k) Q ֒→ T T (k−1) Q (see [11]). With this point of view, we can see any higher-lagrangian problem as a constrained variational problem where we take Σ L = {µ ∈ T * T T (k−1) Q | j * k µ = dL}. In this case, a curve σ : I → Q is a solution of the higher-order variational problem determined by L : Taking the time derivative of the last equation, we obtain ∂Φ α ∂q i (q(t),μ(t))q i (t) + ∂Φ α ∂p i (q(t),μ(t))μ i (t) = 0 and, using equations (2.16), we get a new constraint equation: Proceeding further, we would derive the classical Dirac-Bergmann constraint algorithm (see [2,15]).

2.7.
Optimal Control Theory. Generally speaking, an optimal control problem from the differential geometric viewpoint is given by a vector field depending on some parameters called controls, some boundary conditions and a cost function whose integral must be either minimized or maximized. Concretely, an optimal control problem (U, Q, Γ, L) is given by a control bundle τ U,Q : U → Q, a vector field Γ along the control bundle projection τ U,Q , a cost function L : U → R whose functional must be minimized, and some endpoint or boundary conditions that must be satisfied at initial and/or final time. By definition, the vector field Γ along τ U,Q verifies τ T Q • Γ = τ U,Q . We have the diagram u)) which defines the control equationsq i = Γ i (q, u). From the optimal control data (U, Q, Γ, L), we construct Pontryagin's hamiltonian H : T * Q × Q U −→ R given by where u q ∈ U q and α q ∈ T * q Q. In coordinates, H(q i , p i , u a ) = p i Γ i (q, u)−L(q, u). The usual technique to solve an optimal control problem is Pontryagin's Maximum Principle (see, for instance, [4,37]), which provides us with a set of necessary conditions for optimality.
The optimal control solutions can be also characterized using the generalized variational calculus. For that, we define the subset of T * T Q: Observe that it is not in general a submanifold of T * T Q.
Locally, if we take an arbitrary element µ = µ i dq i +μ j dq j ∈ T * T Q, then µ ∈ Σ if: From Definition 2.6, we have that a curve µ : I → Σ is a solution of the generalized variation problem determined by Σ if it verifies the following set of equations Replacing the expression of µ i from the second equation in the first one, we obtain the following system: can be written as to regain Hamilton-Pontryaguin's conditions of extremality. In a coordinate system {(q i , y j )} adapted to an arbitrary frame, we have µ = µ i dq i + µ j dy j and Γ(q i , u a ) = (q i , Γ j (q i , u a )). Then we obtain that the conditions for µ belonging to Σ are and using expression (2.4), we deduce the following system of equations where the last equation is the condition for admissibility.
Hence, in terms of Pontryagin's Hamiltonian, the equations of optimal control obtained by using the generalized variational calculus are where H(q,μ j , u a ) =μ j Γ j (q, u) − L(q, u).

Generalized variational calculus on skew-symmetric Lie algebroids
Now, we will show an extension of the generalized variational calculus to other different system of great interest in mechanics: reduced systems and nonholonomic systems. In many cases, Lagrangian or Hamiltonian systems admit a group of symmetries and it is possible to reduce the original system to a new one defined on a reduced space with less degrees of freedom or, in other case, the phase space is reduced due to the presence of nonholonomic constraints. The theory of Lie algebroids or, more generally, skew-symmetric algebroids, provides an unifying framework for all these systems (see [10,16,34,39]). Lie algebroid structure on the vector bundle τ D : D → Q. Therefore, a Lie algebroid over a manifold Q may be thought of as a "generalized tangent bundle" to Q. We will see some interesting examples where this structure appears. For more details see [27].
• A finite dimensional real Lie algebra g where Q = {q} be a unique point. Then, we consider the vector bundle τ g : g → {q}. The sections of this bundle can be identified with the elements of g and, therefore, we can consider the structure of the Lie algebra [·, ·] g as the Lie bracket. The anchor map is ρ ≡ 0. Then, (g, [·, ·] g , 0) is a Lie algebroid over a point. • A tangent bundle of a manifold Q (see Section 2.1). The sections of the bundle τ T Q : T Q → Q are identified with the vector fields on Q, the anchor map ρ : T Q → T Q is the identity function and the Lie bracket defined on Γ(τ T Q ) is induced by the standard Lie bracket of vector fields on Q. • Let φ : Q × G → Q be a right action of G on the manifold Q where G is a Lie group. The induced anti-homomorphism between the Lie algebras g and X(Q) is given by ∆ : g → X(Q), where ∆(ξ) = ξ Q is the infinitesimal generator of the action for ξ ∈ g.
• Let G be a Lie group and we assume that G acts freely and properly on Q. We denote by π : Q → Q = Q/G the associated principal bundle. The tangent lift of the action gives a free and proper action of G on T Q and we denote by T Q = T Q/G the corresponding quotient manifold. The quotient vector bundle , is a Lie algebroid over Q/G. The Lie bracket is defined on Γ(τ T Q/G ) and it is isomorphic to the Lie subalgebra of G-invariant vector fields. Thus, the Lie bracket on T Q is just the bracket of G−invariant vector fields. The anchor map ρ : T Q/G → T (Q/G) is given by ρ([v q ]) = T q π(v q ). This Lie algebroid is called Atiyah algebroid associated with the principal bundle π : Q → Q.
Suppose that (q i ) are local coordinates on Q and that {e A } is a local basis of the space of sections Γ(τ D ), then The functions C C AB , ρ i A ∈ C ∞ (Q) are called the local structure functions of the skewsymmetric algebroid on τ D : D → Q.
A ρ D -admissible curve is a curve γ : Let's define the set which will play a similar role to T (2) Q in Section 2.1. We can define D (2) in an alternative way. Considering two admissible curves γ 1 : I → D and γ 2 : I → D such that γ 1 (0) = γ 2 (0), we say that γ 1 and γ 2 define the same equivalence class if and only if dγ 1 dt (0) = dγ 2 dt (0). The set of these equivalence classes is precisely the set D (2) defined as in (3.1).

We will denote by [γ]
(2) x the elements of D (2) such that τ D (γ(0)) = x. Consider the dual bundle π D : D * → Q. If β ∈ Γ(π D ), then we define the linear functionβ : We define the complete lift of a section in an analogous way to proposition (2.1) as following.
Definition 3.1. The complete lift X c of a section X ∈ Γ(τ D ) is the unique vector field X c ∈ X(D) which verifies the following two conditions: (i) X c is projectable over X by means of (τ D ) * ; that is, (τ D ) * X c = X.
(ii) X c (α) = L X α, for all α ∈ Γ(π D ). Here, L X α ∈ Γ(τ D ) denotes the Lie derivative of α ∈ Γ(π D ) with respect to X ∈ Γ(τ D ) (see [10] for details): Let us assume that we have fixed coordinates (q i ) in Q and an arbitrary frame {e A }, then an arbitrary section X ∈ Γ(τ D ) will have an expression X =X A (q)e A . Moreover, the new frame induces a new system of coordinates (q i , y A ) on D, where v x = y A e A (x) for any v x ∈ D. Using Proposition 3.1 or by a direct change of coordinates, it is not hard to prove that the complete lift X c can be rewritten as Another notion to be used later is that of vertical lift.
Definition 3.2. The vertical lift X v of a section X of D is the unique vector field X v ∈ X(D) verifying the following conditions: In coordinates, X v =X A ∂ ∂y A . For I ⊆ R, a time-dependent section X is a smooth mapping X : I × Q → D such that X(t, x) ∈ D x . Definition 3.3. The tangent lift X T of a time-dependent section on Q is the unique time-dependent vector field X T ∈ X(pr D ), where pr D : I × D → D, verifying the following two conditions: We have the diagram Similarly, we can introduce the vertical lift X V ∈ X(pr D ) of a time-dependent vector field X as where X t is the vector field on Q defined by X t (x) = X(t, x).
The following definition will be useful in the sequel.
Observe that, if X is time-dependent, we have that For a function L : D → R we have

3.2.
Generalized variational problem on skew-symmetric algebroids. As in Section 2, we can directly define generalized variational calculus on skew-symmetric algebroids.
Definition 3.5. A generalized variational problem on a skew-symmetric algebroid D is determined by a submanifold Σ of T * D.
Analogously to Section 2, we deduce that an admissible curve γ : I → D is a solution of the generalized variational problem if there exists µ : (2) x ) = 0.
In local coordinates, we assume that Σ is determined by the vanishing of constraints Φ α = 0 where Φ α : T * D → R. A curve γ : I → D, locally given by γ(t) = (q i (t), y A (t)), is admissible if ρ i A (q(t))y A (t) = dq i (t)/dt. Therefore, we seek a curve µ : Summarizing, we have the following set of equations: In the sequel, we will describe some particular examples of generalized variational calculus on skew-symmetric algebroids.

3.3.
Lagrangian mechanics on skew-symmetric algebroids. Given a function L : D → R, we take Σ = Im(dL) = dL(D) ⊆ T * D. In this case, C = D and we try to find an admissible curve ξ : I → D such that t 1 t 0 dL(ξ(t)), X T (t, ξ(t)) dt = 0, for all time dependent section X of τ D : D → Q. From this equation we derive the Euler-Lagrange equations (see [34,39]) given by

The Euler-Poincaré equations.
See [19,20,33]). In this case, we have a Lagrangian l : g → R defined on the Lie algebra g of a Lie group G and we consider Σ = dl(g) ⊆ T * g ≃ g × g * . A time-dependent section is then a curve η : I → g and, therefore, its tangent lift is the time-dependent vector field on g defined by η T (t, ξ) = (ξ,η(t) + ad ξ η(t)) ∈ g × g ≃ T g. Hence, a curve ξ : I → g is a solution of the generalized variational problem if From this, we deduce the classical Euler-Poincaré equations where g is a Riemannian metric on Q and V : Q → R is a potential function. Additionally, in the case of nonholonomic mechanics, we have a regular distribution D ⊆ T Q. Using the Riemannian metric g, we consider the Riemannian orthogonal decomposition T Q = D ⊕ D ⊥,g and we denote by i D : D ֒→ T Q the canonical inclusion and by P : T Q → D the associated orthogonal projector. We induce a skew-symmetric algebroid structure [[X, Y ]] D = P [i D X, i D Y ], for X, Y ∈ Γ(τ D ) (See for instance [3,17]  We are now able to apply our generalized variational calculus to the mechanical system determined by L : D → R and D, with its mentioned skew-symmetric algebroid structure induced from the orthogonal projection of the standard Lie bracket to D. Hence, a solution of the nonholonomic problem is a curve γ : I → D such that γ is admissible and there exists a curve µ : I → Im(dL) ⊆ T * D such that π T D (µ(t)) = γ(t) and, for all time-dependent section X of τ D : D → Q, where X T is the tangent lift given by the induced skew-symmetric algebroid structure. Then, the equations of the nonholonomic problem are equations (3.6) which are the Lagrange-d'Alembert's equations in this context (see [3]). It is easy to adapt the previous calculations to nonholonomic systems with symmetries (see [6,17]).

3.4.
Hamiltonian mechanics on skew-symmetric Lie algebroids. Let H : D * → R be a function where π D : D * → Q is the dual bundle of an skew-symmetric algebroid τ D : D → Q. In a similar way to section 2.4, it is defined an antisymplectomorphism R : T * D * → T * D (see [16,28]). In local coordinates, if (q i ) are coordinates on Q and {e A } is a basis of sections of τ D : D → Q, then we have the dual basis of section {e A } on D * (that is, e A (e B ) = δ A B ). This dual basis induces coordinates (q i , p A ) on D * . The antisymplectomorphism R is given by Now, we construct the submanifold Σ H ⊆ T * D by Σ = R(dH(D * )). Locally, An admissible curve γ : I → D is a solution of the Hamiltonian problem given by H : D * → R if there exists a curve µ : I → Σ such that I µ(t), X T (t, γ(t)) dt = 0, for all time-dependent section X of τ D : D → Q.
If µ : I → Σ is given by µ(t) = (q i (t), y A (t), µ i (t),μ A (t)), then equations (3.5) are equivalent to the following set of equations: which are Hamilton's equations in the context of skew-symmetric Lie algebroids (see [10]).
A solution of the generalized variational problem is characterized by which give us the classical Lie-Poisson equations (see [19,20]) 3.5. Constrained variational calculus. Now, we study the case of variational constrained calculus on the setting of skew-symmetric algebroids (see [16,23]). We will see how to define a submanifold of T * D to apply our generalized variational calculus and to derive the corresponding equations in this case.
The variational constrained problems are determined by a pair (C, l) where C is a submanifold of D, with inclusion i C : C ֒→ D, and l : C → R is a Lagrangian function defined only along C. We will consider We can also write Σ l as Here L : D → R is an arbitrary extension of l to D (i.e., l • i C = L) and ν * (C) is the conormal bundle of C. Considering a curve µ : [t 0 , t 1 ] → Σ l as µ(t) = dL(γ(t)) + ν(t) where ν(t) ∈ (ν * (C)) | γ(t) , and γ is an admissible curve satisfying γ(t) ∈ C ⊆ D, then and a solution is a pair (γ, ν) with γ : I → D admissible and ν(t) ∈ [ν * (C)] γ(t) .
As in Section 2.5, we derive the following system of equations which is a generalization of equations (2.13).
3.6. Optimal Control Theory. An optimal control problem on a skew-symmetric algebroid is given by a quadruple (C, Q, Γ, L) where τ C,Q : C → Q is the control bundle, Γ is a vector field defined along τ C,Q and L : C → R is a cost function whose associated functional must be minimized.
Locally, we have that y A = Γ A (q, u). From the optimal control data (C, Q, Γ, L) we construct Pontryagin's hamiltonian H : D * × Q C −→ R given by where u q ∈ C q and α q ∈ D * q . In coordinates, H(q A , p A , u a ) = p A Γ A (q, u) − L(q, u). Also the optimal control solutions can be characterized using generalized variational calculus. We define the subset If we take an arbitrary element µ = µ i dq i +μ A dy A in T * D, then a solution curve for the generalized variation calculus associated to Σ is given by the following system of equations for some curve u(t) = (u a (t)). Alternatively, in terms of Pontryagin's Hamiltonian H the equations are rewritten as follows: See these equations in references [23,35].

Discrete generalized variational calculus on Q × Q
In this section, we will develop a discrete version of the generalized variational calculus. For that, we will only need to have a subset of an appropriate cotangent bundle and to introduce the notions of discrete complete and vertical lifts.
The main motivation will be the derivation of numerical integrators for the corresponding continuous systems which preserve some of their geometric or invariance properties, see [32]. 4.1. Discrete geometry. The discrete notion of the tangent bundle T Q is the cartesian product of two copies of Q, that is, Q × Q. Now, we have two canonical projections α : Q × Q → Q defined by α(q,q) = q and β : Q × Q → Q defined by β(q,q) =q, where q,q ∈ Q.
Given a curve σ : Z → Q, we define its tangent liftσ : Z → Q × Q as follows: for all k ∈ Z.
As in the continuous case, we need to introduce the notion of discrete complete lift X c ∈ X(Q × Q) of a vector field X ∈ X(Q). It is defined by Moreover, we have two notions of discrete vertical lifts of X given by the following formulas: X vα (q,q) = (X(q), 0q ) and X v β (q,q) = (0 q , X(q)).
In the same way as in section 2.1, for all Z-dependent vector field X : Z × Q → T Q, we have its discrete tangent lift X T : Z × Q × Q → T Q × T Q defined by X T (k, q,q) = (X(k, q), X(k + 1,q)), and we have X Vα (k, q,q) = (X k ) vα (q,q) and X V β (k, q,q) = (X k ) v β (q,q), where X k (q,q) = X(k, q,q).

4.2.
Discrete generalized variational problem. With the above definitions, we can introduce the notion of generalized variational calculus in the context of discrete mechanics as follows.

Lagrangian mechanics.
If we have a discrete Lagrangian L d : Q × Q → R, we can consider Σ d = Im(dL d ) ⊆ T * (Q × Q) and apply the discrete generalized variational calculus. Hence, we obtain that a solution σ : Z → Q satisfies the well-known discrete Euler-Lagrange equations (see [32])

4.5.
Discrete optimal control theory. A discrete optimal control problem is specified by a set (U, Q, Γ d , L d ) where τ U,Q : U → Q is a control bundle and Γ d : U → Q × Q is such that α•Γ d = τ U,Q , being α : Q×Q → Q the projection onto the first factor and L d : U → R is a discrete cost function. If u q ∈ U, then Γ d (u q ) = (q,Γ d (u q )). Taking coordinates (q i , u a ) in U, we have that Γ d (q i , u a ) = (q i , Γ i d (q, u)), that is,Γ d (u q ) = (Γ i (q, u)). As in the continuous case (see Definition 4.3), the discrete optimal control solution can be obtained from the following subset of T * (Q × Q) : Locally, considering coordinates (q i ,q i ) in T * (Q × Q) ≃ T * Q × T * Q we can write µ = (µ 1 ) i dq i + (µ 2 ) i dq i , and µ ∈ Σ d implies that Then, a solution curve σ : Z → Q is such that there exists a curve µ : Z → Σ d given by µ(k) = (µ 1 (k), µ 2 (k)), verifying the following system of equations: where the three first equations are equivalent to µ ∈ Σ d , and the last one is equivalent to E d µ (k, k + 1) = 0.
Using the last equation in the two first of them, we obtain (4.6) And, if we define locally H(q, µ 1 , u) = (µ 1 ) i Γ i d (q, u) + L(q, u), we obtain the following system These are the discrete optimal control equations in this context (see [26]).

Discrete generalized variational calculus on Lie groupoids
As said in the previous section, the cartesian product Q×Q plays the role of the tangent bundle T Q in the discrete setting. The geometric relation between both spaces is expressed saying that Q × Q has a groupoid structure being T Q its associated Lie algebroid. The purpose of this section is to describe a version of discrete generalized variational calculus adapted to general Lie groupoids covering interesting cases of discrete reduced dynamics (see [40,29,31]).

Lie groupoids.
Definition 5.1. A Lie groupoid, denoted by G ⇒ Q, consists of two differentiable manifolds G and Q, and the following differentiable maps (the structural maps).
(i) A pair of submersions: the source map α : G → Q and the target map β : G → Q. (ii) An associative multiplication map m : is called the set of composable pairs, such that m(g, h) = gh. (iii) An identity section ǫ : Q → G of α and β, such that for all g ∈ G, ǫ (α(g)) g = g = g ǫ (β(g)) .
b(q, v). Note that b(q, 0) = q. Two elements g and h with coordinates (q, v) and (q,ṽ) are composable if and only ifq = b(q, v). Hence, local coordinates for G 2 are given by (q, v,ṽ).
Next we consider a symmetric neighborhood W associated to q 0 and U . If two elements g, h ∈ W with coordinates (q, v) and (q,ṽ), respectively, are composable, then the product gh has coordinates (q, p(q, v,ṽ)) for some smooth function p. We will write (q, v) · (q,ṽ) = (q, p(q, v,ṽ)).
We can define the following functions in terms of b(q, v) and p(q, v,ṽ), ∂p A ∂v B (q, 0,ṽ). We will also take into account that Invariant vector fields. If g 0 ∈ W ⊂ G has coordinates (q 0 , v 0 ), then the elements on the α-fiber α −1 (β(g 0 )) have coordinates of the form (b(q 0 , v 0 ),ṽ), and the coordinates of l g 0 (g) are (q 0 , p(q 0 , v 0 ,ṽ)). We will write Similarly, for h 0 = (q 0 , v 0 ) ∈ W ⊂ G, we will write A left-invariant vector field has the form ← − X (g) = T ǫ(β(g)) l g (w), for w ∈ ker T ǫ(β(g)) α. To obtain a local basis of left-invariant vector fields, we can take the local coordinate basis of ker T ǫ(β(g)) α. Thus, for g ∈ G with coordinates (q, v), we have Similarly, a right-invariant vector field can be written in the form − → X (g) = T ǫ(α(g)) r g (w), for w ∈ ker T ǫ(α(g)) β. It can be proved that a basis of right invariant vector fields is given by where as before (q, v) are the coordinates for g ∈ G (see [30] for details).

5.3.
Discrete Euler-Lagrange operator. As in section 4, we need to introduce the notion of lifts of sections of the associated Lie algebroid. If X ∈ Γ(τ AG ), we define its complete lift X c ∈ X(G) as
A discrete constrained variational problem is defined by a pair (C d , l d ) where C d is a submanifold of a Lie groupoid G with inclusion i C d : C d ֒→ G, and l d : C d → R is a function. Now, we consider the submanifold Σ l d = {µ ∈ T * G : π T G (µ) ∈ C d and µ, v = dl d , v , for all v ∈ T C d ⊆ T G such that τ T G (v) = π T G (µ)} .
In other words, Σ l d = µ ∈ T * G : i * C d µ = dl d = (dL d + ν * (C d )) | C d , where L d : G → R is an arbitrary extension of l d to G, and ν * (C d ) is the associated conormal bundle.

5.7.
Discrete optimal control theory on Lie groupoids. A discrete optimal control problem on a Lie groupoid G is given by a set (U, Q, Γ d , L d ) where τ U,Q : U → Q is a control bundle, Γ d : U → G is such that α • Γ d = τ U,Q , being α : G → Q the projection, and L d : U → R is a discrete cost function (see [35]).
As we saw in section 4.5, the discrete optimal control solution can be obtained from the following subset of T * G : In local coordinates on the Lie groupoid, we obtain the following system of equations: ∂L d ∂q i (q k , u k ) = (µ 1 ) i (q k , u k ) + (µ 2 ) A (q k , u k )

Conclusions
In this paper, we have introduced many of the most important equations of motion of mechanical systems using a generalization of variational calculus where the main ingredient is played by a subset of the cotangent space of the velocity phase space. Cases like standard Lagrangian mechanics, nonholonomic mechanics, constrained variational calculus, hamiltonian mechanics, systems admitting a Lie group of symmetries, among others, are naturally included in this framework. Moreover, it is possible to extend this technique to the case of discrete mechanics using a parallel construction.
In the future, we will study how the constraint algorithms work in the setting of generalized variational calculus, and the extension of our method to the case of discrete nonholonomic mechanics (see [25]) and discrete hamiltonian systems. In our future work, we will also develop other topics such as generalized variational calculus both in the case of Dirac structures modeling mechanics and the theory of interconnection.