User:Prof McCarthy/generalized coordinates

In analytical mechanics, specifically the study of the rigid body dynamics of multibody systems, the term generalized coordinates refers to the parameters that describe the configuration of the system relative to some reference configuration. These parameters must uniquely define the configuration of the system relative to the reference configuration.

An example of a generalized coordinate is the angle that locates a point moving on a circle, in contrast to its x and y coordinates. The adjective "generalized" distinguishes these parameters from the traditional use of the term coordinate as measured against a specified line, such as Cartesian coordinates.

Parameters that are convenient for the specification of the configuration of a system are selected to be generalized coordinates. If these parameters are independent of one another, then number of independent generalized coordinates is defined by the number of degrees of freedom of the system.

The generalized velocities are the time derivatives of the generalized coordinates of the system.

Simple pendulum
The relationship between the use of generalized coordinates and Cartesian coordinates to characterize the movement of a mechanical system can be illustrated by considering the simple pendulum.

Coordinates
A simple pendulum consists of a mass M hanging from a pivot point so that it is constrained to move on a circle of radius L. The position of the mass is defined by the coordinate vector r=(x, y} measured in the plane of the circle such that y is in the vertical direction.  The coordinates x and y are related by the equation of the circle
 * $$f(x, y) = x^2+y^2 - L^2=0,$$

that constrains the movement of M. This equation also provides a constraint on the velocity components,
 * $$ \frac{df}{dt}(x, y)=x\dot{x} + y\dot{y} = 0.$$

Now introduce the parameter θ, that defines the angular position of M from the vertical direction. It can be used to define the coordinates x and y, such that
 * $$ \mathbf{r}=(x, y) = (L\sin\theta, -L\cos\theta).$$

The use of θ to define the configuration of this system avoids the constraint provided by the equation of the circle.

Virtual work
Notice that the force of gravity acting on the mass M is formulated in the usual Cartesian coordinates,
 * $$ \mathbf{F}=(0,-Mg),$$

where g is the acceleration of gravity.

The virtual work of gravity on the mass M as it follows the trajectory r is given by
 * $$ \delta W = \mathbf{F}\cdot\delta \mathbf{r}.$$

The variation δr can be computed in terms of the coordinates x and y, or in terms of the parameter θ,
 * $$ \delta \mathbf{r} =(\delta x, \delta y) = (L\cos\theta, L\sin\theta)\delta\theta.$$

Thus, the virtual work is given by
 * $$\delta W = -Mg\delta y = -MgL\sin\theta\delta\theta.$$

Notice that the coefficient of δy is the y-component of the applied force. In the same way, the coefficient of δθ is viewed as the generalized force along generalized coordinate θ, given by
 * $$ F_{\theta} = -MgL\sin\theta.$$

Kinetic energy
To complete the analysis consider the kinetic energy T of the mass, using the velocity,
 * $$ \mathbf{v}=(\dot{x}, \dot{y}) = (L\cos\theta, L\sin\theta)\dot{\theta},$$

so,
 * $$ T= \frac{1}{2}M\mathbf{v}\cdot\mathbf{v} = \frac{1}{2}M(\dot{x}^2+\dot{y}^2) = \frac{1}{2}ML^2\dot{\theta}^2.$$

Lagrange's equations
Lagrange's equations for the pendulum in terms of the coordinates x and y are given by,
 * $$ \frac{d}{dt}\frac{\partial T}{\partial \dot{q}_i} - \frac{\partial T}{\partial q_i} = F_{q_i} + \lambda \frac{\partial f}{\partial q_i}. $$

This yields the three equations
 * $$ M\ddot{x} = \lambda(2x),\quad M\ddot{y} = -Mg + \lambda(2y),\quad x^2+y^2 - L^2=0,$$

in the three unknowns, x, y and λ.

Compute two derivatives of the constraint equation and assemble the equations into matrix form
 * $$\begin{bmatrix}

M & 0 & - 2x \\ 0 & M & -2y \\ -2x & -2y & 0 \end{bmatrix} \begin{Bmatrix} \ddot{x} \\ \ddot{y} \\ \lambda \end{Bmatrix} = \begin{Bmatrix} 0\\ -Mg \\ 2\dot{x}^2 + 2\dot{y}^2 \end{Bmatrix} $$

Using the parameter θ, Lagrange's equations take the form
 * $$ ML^2\ddot{\theta} = -MgL\sin\theta,$$

or
 * $$ \ddot{\theta} + \frac{g}{L}\sin\theta=0.$$

This shows that the parameter θ is a generalized coordinate that can be used in the same way as the Cartesian coordinates x and y to analyze the pendulum.

Double pendulum
The benefits of generalized coordinates become apparent with the analysis of a double pendulum. For the two masses mi, i=1, 2, let r=(xi, yi), i=1, 2 define their two trajectories. These vectors satisfy the two constraint equations,
 * $$f_1 (x_1, y_1, x_2, y_2) = \mathbf{r}_1\cdot \mathbf{r}_1 - L_1^2 = 0, \quad f_2 (x_1, y_1, x_2, y_2) = (\mathbf{r}_2-\mathbf{r}_1) \cdot (\mathbf{r}_2-\mathbf{r}_1) - L_2^2 = 0.$$

The formulation of Lagrange's equations for this system yields six equations in the four Cartesian coordinates xi, yi i=1, 2 and the two Lagrange multipliers λi, i=1, 2 that arise from the two constraint equations.

Coordinates
Now introduce the generalized coordinates θi i=1,2 that define the angular position of each mass of the double pendulum from the vertical direction. In this case, we have
 * $$\mathbf{r}_1 = (L_1\sin\theta_1, -L_1\cos\theta_1), \quad \mathbf{r}_2 = (L_1\sin\theta_1, -L_1\cos\theta_1) + (L_2\sin\theta_2, -L_2\cos\theta_2).$$

The force of gravity acting on the masses is given by,
 * $$\mathbf{F}_1=(0,-m_1 g),\quad \mathbf{F}_2=(0,-m_2 g)$$

where g is the acceleration of gravity. Therefore, the virtual work of gravity on the two masses as they follow the trajectories ri, i=1,2 is given by
 * $$ \delta W = \mathbf{F}_1\cdot\delta \mathbf{r}_1 + \mathbf{F}_2\cdot\delta \mathbf{r}_2.$$

The variations δri i=1, 2 can be computed to be
 * $$ \delta \mathbf{r}_1 = (L_1\cos\theta_1, L_1\sin\theta_1)\delta\theta_1, \quad \delta \mathbf{r}_2 = (L_1\cos\theta_1, L_1\sin\theta_1)\delta\theta_1 +(L_2\cos\theta_2, L_2\sin\theta_2)\delta\theta_2$$

Virtual work
Thus, the virtual work is given by
 * $$\delta W = -(m_1+m_2)gL_1\sin\theta_1\delta\theta_1 - m_2gL_2\sin\theta_2\delta\theta_2,$$

and the generalized forces are
 * $$F_{\theta_1} = -(m_1+m_2)gL\sin\theta_1,\quad F_{\theta_2} =  -m_2gL\sin\theta_2.$$

Kinetic energy
Compute the kinetic energy of this system to be
 * $$ T= \frac{1}{2}m_1 \mathbf{v}_1\cdot\mathbf{v}_1 + \frac{1}{2}m_2 \mathbf{v}_2\cdot\mathbf{v}_2 = \frac{1}{2}(m_1+m_2)\dot{\theta}_1^2 + \frac{1}{2}m_2\dot{\theta}_2^2 + m_2L_1L_2 \cos(\theta_2-\theta_1)\dot{\theta}_1\dot{\theta}_2.$$

Lagrange's equations
Lagrange's equations yield two equations in the unknown generalized coordinates θi i=1, 2, given by
 * $$(m_1+m_2)L_1\ddot{\theta}_1+m_2L_1L_2\ddot{\theta}_2\cos(\theta_2-\theta_1) + m_2L_1L_2\sin(\theta_2-\theta_1) = -(m_1+m_2)gL\sin\theta_1,$$

and
 * $$m_2L_2\ddot{\theta}^2+m_2L_1L_2\ddot{\theta}_1\cos(\theta_2-\theta_1) - m_2L_1L_2\sin(\theta_2-\theta_1)=-m_2gL\sin\theta_2.$$

The use of the generalized coordinates θi i=1, 2 provides an alternative to the Cartesian formulation of the dynamics of the double pendulum.

Constraint equations
Generalized coordinates may be independent (or unconstrained), in which case they are equal in number to the degrees of freedom of the system, or they may be dependent (or constrained), related by constraints on and among the coordinates. The number of dependent coordinates is the sum of the number of degrees of freedom and the number of constraints. For example, the constraints might take the form of a set of configuration constraint equations:


 * $$ f_i ( \{q_n\}, \ t) = 0 \, $$

where qn is the n-th generalized coordinate and i denotes one of a set of constraint equations, taken here to vary with time t. The constraint equations limit the values available to the set of qn, and thereby exclude certain configurations of the system.

It can be advantageous to choose independent generalized coordinates, as is done in Lagrangian mechanics, because this eliminates the need for constraint equations. However, in some situations, it is not possible to identify an unconstrained set. For example, when dealing with nonholonomic constraints or when trying to find the force due to any constraint—holonomic or not, dependent generalized coordinates must be employed. Sometimes independent generalized coordinates are called internal coordinates because they are mutually independent, otherwise unconstrained, and together give the position of the system.



A system with $$m$$ degrees of freedom and n particles whose positions are designated with three dimensional vectors, $$\lbrace \mathbf {r}_i \rbrace$$, implies the existence of $$3 n-m$$ scalar constraint equations on those position variables. Such a system can be fully described by the scalar generalized coordinates, $$\lbrace q_1, q_2, ..., q_m\rbrace$$, and the time, $$t$$, if and only if all $$m$$ $$\lbrace q_j \rbrace$$ are independent coordinates. For the system, the transformation from old coordinates to generalized coordinates may be represented as follows:


 * $$\mathbf{r}_1=\mathbf{r}_1(q_1, q_2, ..., q_m, t)$$,
 * $$\mathbf{r}_2=\mathbf{r}_2(q_1, q_2, ..., q_m, t)$$, ...
 * $$\mathbf{r}_n=\mathbf{r}_n(q_1, q_2, ..., q_m, t)$$.

This transformation affords the flexibility in dealing with complex systems to use the most convenient and not necessarily inertial coordinates. These equations are used to construct differentials when considering virtual displacements and generalized forces.

Double pendulum
A double pendulum constrained to move in a plane may be described by the four Cartesian coordinates {x1, y1, x2, y2}, but the system only has two degrees of freedom, and a more efficient system would be to use
 * $$\lbrace q_1, q_2 \rbrace = \lbrace\theta_1,\theta_2 \rbrace$$,

which are defined via the following relations:
 * $$\lbrace x_1, y_1 \rbrace = \lbrace L_1\sin\theta_1,  L_1\cos\theta_1 \rbrace$$
 * $$\lbrace x_2, y_2 \rbrace = \lbrace L_1\sin\theta_1+L_2\sin\theta_2,  L_1\cos\theta_1+L_2\cos\theta_2 \rbrace$$

Bead on a wire
A bead constrained to move on a wire has only one degree of freedom, and the generalized coordinate used to describe its motion is often
 * $$q_1= l$$,

where l is the distance along the wire from some reference point on the wire. Notice that a motion embedded in three dimensions has been reduced to only one dimension.

Motion on a surface
A point mass constrained to a surface has two degrees of freedom, even though its motion is embedded in three dimensions. If the surface is a sphere, a good choice of coordinates would be:
 * $$\lbrace q_1, q_2 \rbrace = \lbrace \theta, \phi \rbrace $$,

where θ and φ are the angle coordinates familiar from spherical coordinates. The r coordinate has been effectively dropped, as a particle moving on a sphere maintains a constant radius.

Generalized velocities and kinetic energy
Each generalized coordinate $$q_i$$ is associated with a generalized velocity $$\dot q_i$$, defined as:
 * $$\dot q_i={dq_i \over dt}$$

The kinetic energy of a particle is
 * $$T = \frac {m}{2} \left ( \dot x^2 + \dot y^2 + \dot z^2 \right )$$.

In more general terms, for a system of $$p$$ particles with $$n$$ degrees of freedom, this may be written
 * $$T =\sum_{i=1} ^p \frac {m_i}{2} \left ( \dot x_i^2 + \dot y_i^2 + \dot z_i^2 \right )$$.

If the transformation equations between the Cartesian and generalized coordinates
 * $$x_i = x_i \left (q_1, q_2, ..., q_n, t \right )$$
 * $$y_i = y_i \left (q_1, q_2, ..., q_n, t \right )$$
 * $$z_i = z_i \left (q_1, q_2, ..., q_n, t \right )$$

are known, then these equations may be differentiated to provide the time-derivatives to use in the above kinetic energy equation:
 * $$\dot x_i = \frac {d}{dt} x_i \left (q_1, q_2, ..., q_n, t \right ).$$

It is important to remember that the kinetic energy must be measured relative to inertial coordinates. If the above method is used, it means only that the Cartesian coordinates need to be inertial, even though the generalized coordinates need not be. This is another considerable convenience of the use of generalized coordinates.

Applications of generalized coordinates
Such coordinates are helpful principally in Lagrangian mechanics, where the forms of the principal equations describing the motion of the system are unchanged by a shift to generalized coordinates from any other coordinate system. The amount of virtual work done along any coordinate $$q_i$$ is given by:
 * $$\delta W_{q_i} = F_{q_i} \cdot \delta q_i $$,

where $$F_{q_i}$$ is the generalized force in the $$q_i$$ direction. While the generalized force is difficult to construct 'a priori', it may be quickly derived by determining the amount of work that would be done by all non-constraint forces if the system underwent a virtual displacement of $$\delta q_i $$, with all other generalized coordinates and time held fixed. This will take the form:
 * $$\delta W_{q_i} = f \left ( q_1, q_2, ..., q_n \right ) \cdot  \delta q_i $$,

and the generalized force may then be calculated:
 * $$F_{q_i} = \frac {\delta W_{q_i}}{\delta q_i} = f \left ( q_1, q_2, ..., q_n \right ) $$.

Generalized coordinates and virtual work
The principle of virtual work states that the virtual work of the applied forces is zero for all virtual movements of the system from static equilibrium, that is, δW=0 for any variation δr. When formulated in terms of generalized coordinates, this is equivalent to the requirement that the generalized forces for any virtual displacement are zero, that is Fi=0.

Let the forces on the system be Fj, j=1, ..., m and let the virtual displacement of each point of application of these forces be δrj, j=1, ..., m, then the virtual work generated by a virtual displacement of these forces from the equilibrium position is given by
 * $$\delta W = \sum_{j=1}^m \mathbf{F}_j\cdot \delta\mathbf{r}_j.$$

Now assume that each δrj depends on the generalized coordinates qi, i=1, ..., n, then
 * $$ \delta \mathbf{r}_j = \frac{\partial \mathbf{r}_j}{\partial q_1} \delta{q}_1 + \ldots + \frac{\partial \mathbf{r}_j}{\partial q_n} \delta{q}_n,$$

and
 * $$ \delta W = \left(\sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{r}_j}{\partial q_1}\right) \delta{q}_1 + \ldots + \left(\sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{r}_j}{\partial q_n}\right) \delta{q}_n. $$

The n terms
 * $$ F_i = \sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{r}_j}{\partial q_i},\quad i=1,\ldots, n,$$

are the generalized forces acting on the system. Kane shows that these generalized forces can also be formulated in terms of the ratio of time derivatives,
 * $$ F_i = \sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{v}_j}{\partial \dot{q}_i},\quad i=1,\ldots, n,$$

where vj is the velocity of the point of application of the force Fj.

In order for the virtual work to be zero for an arbitrary virtual displacement, each of the generalized forces must be zero, that is
 * $$ \delta W = 0 \quad \Rightarrow \quad F_i =0, i=1,\ldots, n.$$