You are on page 1of 23

Generalized Coordinates, Lagrange’s Equations, and Constraints

CEE 541. Structural Dynamics
Department of Civil and Environmental Engineering
Duke University
Henri P. Gavin
Fall, 2016

1 Cartesian Coordinates and Generalized Coordinates
The set of coordinates used to describe the motion of a dynamic system is not unique.
For example, consider an elastic pendulum (a mass on the end of a spring). The position of
the mass at any point in time may be expressed in Cartesian coordinates (x(t), y(t)) or in
terms of the angle of the pendulum and the stretch of the spring (θ(t), u(t)). Of course, these
two coordinate systems are related. For Cartesian coordinates centered at the pivot point,
x(t) =
(l + u(t)) sin θ(t)
y(t) = −(l + u(t)) cos θ(t)

y
y = −(l+u)cos θ

x
l

θ

where l is the un-stretched length of the spring. Let’s define
"

r(t) =

u

K
M

(1)
(2)

r1 (t)
r2 (t)

#

"

=

x(θ(t), u(t))
y(θ(t), u(t))

g and

"

q(t) =

x = (l+u)sin θ

q1 (t)
q2 (t)

#

"

=

#

"

=

(l + u(t)) sin θ(t)
−(l + u(t)) cos θ(t)
θ(t)
u(t)

#

(3)

#

(4)

so that r(t) is a function of q(t).
The potential energy, V , may be expressed in terms of r or in terms of q.
In Cartesian coordinates, the velocities are
"

r˙ (t) =

r˙1 (t)
r˙2 (t)

#

"

=

˙
u(t)
˙ sin θ(t) + (l + u(t)) cos θ(t)θ(t)
˙
−u(t)
˙ cos θ(t) + (l + u(t)) sin θ(t)θ(t)

#

(5)

So, in general, Cartesian velocities r˙ (t) can be a function of both the velocity and position of
some other coordinates (q(t)
˙
and q(t)). Such coordinates q are called generalized coordinates.
The kinetic energy, T , may be expressed in terms of either r˙ or, more generally, in terms of
q˙ and q.
Small changes (or variations) in the rectangular coordinates, (δx, δy) consistent with all
displacement constraints, can be found from variations in the generalized coordinates (δθ, δu).
∂x
∂x
δθ +
δu = (l + u(t)) cos θ(t)δθ + sin θ(t)δu
∂θ
∂u
∂y
∂y
δy =
δθ +
δu = (l + u(t)) sin θ(t)δθ − cos θ(t)δu
∂θ
∂u

δx =

(6)
(7)

2

CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin

2 Principle of Virtual Displacements
Virtual displacements δri are any displacements consistent with the constraints of the
system. The principle of virtual displacements1 says that the work of real external forces
through virtual external displacements equals the work of the real internal forces arising
from the real external forces through virtual internal displacements consistent with the real
external displacements. In system described by n coordinates ri , with n internal inertial
forces M r¨i (t), potential energy V (r), and n external forces pi collocated with coordinates ri ,
the principle of virtual dispalcements says,
n
X
i=1

∂V
M r¨i +
∂ri

!

δri =

n
X

(pi (t)) δri

(8)

i=1

3 Minimum Total Potential Energy
The total potential energy, Π, is defined as the internal potential energy, V , minus the
potential energy of external forces2 . In terms of the r (Cartesian) coordinate system and
n forces fi collocated with the n displacement coordinates, ri , the total potential energy is
given by equation (9).
Π(r) = V (r) −

n
X

(9)

fi ri .

i=1

The principle of minimum total potential energy states that the total potential energy is
minimized in a condition of equilibrium. Minimizing the total potential energy is the same
as setting the variation of the total potential energy to zero. For any arbitrary set of “variational” displacements δri (t), consistent with displacement constraints,
min Π(r) ⇒ δΠ(r) = 0 ⇔
r

n
n
X
X
∂V
∂Π
fi δri = 0 ,
δri = 0 ⇔
δri −
i=1 ∂ri
i=1
i=1 ∂ri

n
X

(10)

In a dynamic situation, the forces fi can include inertial forces, damping forces, and external
loads. For example,
fi (t) = −M r¨i (t) + pi (t) ,
(11)
where pi is an external force collocated with the displacement coordinate ri . Substituting
equation (11) into equation (10), and rearranging slightly, results in the d’Alembert-Lagrange
equations, the same as equation (8) found from the principle of virtual displacements,
n
X
i=1

!

∂V
M r¨i (t) +
− pi (t) δri = 0 .
∂ri

(12)

In equations (8) and (12) the virtual displacements (i.e., the variations) δri must be arbitrary
and independent of one another; these equations must hold for each coordinate ri individually.
M r¨i (t) +

∂V
− pi (t) = 0 .
∂ri

(13)

1

d’Alembert, J-B le R, 1743
In solid mechanics, internal strain energy is conventionally assigned the variable U , whereas the potential
energy of external forces is conventionally assigned the variable V . In Lagrange’s equations potential energy
is assigned the variable V and kinetic energy is denoted by T .
2

CC BY-NC-ND HP Gavin

∂ r˙i (15) Applying the product and chain rules of calculus to equation (15). m X ∂V ∂V ∂qj ∂ri δri = δqj . Next. q(t) and q(t). d dt ∂T δri ∂ r˙i  ! = M r¨i δri + M r˙i d δri dt (16)  m d  ∂T X ∂ r˙i  ∂T δqj = M r¨i δri + δ r˙i dt ∂ r˙i j=1 ∂ q˙j ∂ r˙i  M r¨i δri (17)  m m ∂ r˙i  ∂T X ∂ r˙i d  ∂T X = δqj − δqj . and ∂T δri = M r˙i δri . expressing the work of external forces pi in terms of the new coordinates qj . dt j=1 ∂qj (14) Now. rearranging the order of the summations. δri = m X ∂ r˙i ∂ri δqj = δqj j=1 ∂ q˙j j=1 ∂qj m X and m X d ∂ r˙i δri = δ r˙i = δqj . factoring out the common δqj . P The first goal. is to relate the work of inertial forces ( i M r¨i δri ) to the kinetic energy in terms of a set of generalized coordinates. leaves the equation in terms CC BY-NC-ND HP Gavin . (19) and (20) into equation (12). The kinetic energy in terms of velocities in Cartesian coordinates is given by T (˙r) = 12 M (r˙12 + r˙22 ). Substituting equations (18). in coordinate systems where the kinetic energy depends on the position and velocity of some generalized coordinates.3 Generalized Coordinates and Lagrange’s Equations 4 Derivation of Lagrange’s equations from “f = ma” For many problems equation (13) is enough to determine equations of motion. n X i=1 pi (t) δri = n X i=1 pi (t) m X m X n m X X ∂ri ∂ri δqj = pi (t) δqj = Qj (t) δqj . changing the derivatives of the potential energy from ri to qj . ˙ expressions for inertial forces become more complicated. To do this requires a change of coordinates from variations in n Cartesian coordinates δr to variations in m generalized coordinates δq. canceling the ∂ri and ∂ r˙i terms. consider the kinetic energy of a constant mass M . and eliminating the sum over i. ∂qj j=1 ∂qj j=1 i=1 j=1 (20) where Qj (t) are called generalized forces. However. (19) ∂ri j=1 ∂qj ∂ri ∂qj Finally. then. dt ∂ r˙i j=1 ∂ q˙j ∂ r˙i j=1 ∂qj (18) P Equation (18) is a step to getting the work of inertial forces ( i M r¨i δri ) in terms of a set of generalized coordinates qj .

Mm Ve Courcier. this equation must hold for each generalized coordinate qj individually..4 CEE 541. ˙ t) − V (q. q.L. Mecanique analytique. 5 The Lagrangian Lagrange’s equations may be expressed more compactly in terms of the Lagrangian of the energies. J.3 d dt ∂T ∂ q˙j ! − ∂V ∂T + − Qj = 0 ∂qj ∂qj (21) are which are applicable in any coordinate system. Removing the summation over j and canceling out the common δqj factor results in Lagrange’s equations. q. Structural Dynamics – Duke University – Fall 2016 – H. d dt 3 ∂L ∂ q˙j ! − ∂L − Qj = 0 ∂qj (23) Lagrange. ˙ Lagrange’s equations may be written. ˙ t) ≡ T (q. Gavin of qj and q˙j . Cartesian or not. CC BY-NC-ND HP Gavin .P. n X     m m m m X X ∂ r˙i  ∂T X ∂ r˙i ∂V ∂qj ∂ri ∂ri d ∂T X   δqj − δqj + δqj − pi (t) δqj  = 0 dt ∂ r ˙ ∂ q ˙ ∂ r ˙ ∂q ∂q ∂r ∂q ∂q i j i j j i j j i=1 j=1 j=1 j=1 j=1 m n X X j=1 i=1 " d dt ∂T ∂ r˙i ∂ r˙i ∂ q˙j ! ∂T ∂ r˙i ∂V ∂qj ∂ri ∂ri − + − pi ∂ r˙i ∂qj ∂qj ∂ri ∂qj ∂qj m X j=1 " d dt ∂T ∂ q˙j ! ∂T ∂V − + − Qj ∂qj ∂qj # δqj = 0 # δqj = 0 The variations δqj must be arbitrary and independent of one another. 1811. q. and not on the velocities. q. t) (22) Since the potential energy V depends only on the positions. L(q.

“On a General Method in Dynamics. 95-144 CC BY-NC-ND HP Gavin . t) (24) and define an action potential functional S[q(t)] = Z t2 L(q. ˙ t) dt (25) t1 with end points q1 = q(t1 ) and q2 = q(t2 ). dt ∂ q˙i ∂qi ∂qi 4 Hamilton. If the conditions for admissible variations in position δq fully specify the conditions for admissible variations in velocity δ q. (26) dt and we can integrate the first term by parts. q. Consider the true path of q(t) from t1 to t2 and a variation δq(t) such that δq(t1 ) = 0 and δq(t2 ) = 0. d δqi = δ q˙i . ˙ t) − V (q.R. ˙ t) ≡ T (q. δ q˙i . W. of the Royal Society Part II (1834) pp. Part I (1835) pp. q. ˙ t) dt = 0 t1 Substituting the Lagrangian into Hamilton’s principle. ˙ the variation and the differentiation can be transposed. Hamilton’s principle:4 The solution q(t) is an extremum of the action potential S[q(t)] ⇐⇒ δS[q(t)] =0 Z ⇐⇒ t2 δL(q. 247-308. Z t2 t1 " ∂T ∂T δ q˙i = δqi ∂ q˙i ∂ q˙i #t2 − t1 Z t2 t1 d dt ! ∂T δqi dt ∂ q˙i Since δq(t1 ) = 0 and δq(t2 ) = 0. so the term within the square brackets must be zero for all i. q.” Phil. Z t2 (X " t1 i d − dt ! ∂T ∂T ∂V δqi + δqi − δqi ∂ q˙i ∂qi ∂qi #) dt = 0 The variations δqi must be arbitrary. Trans. q.5 Generalized Coordinates and Lagrange’s Equations 6 Explanation of Lagrange’s equations in terms of Hamilton’s principle Define a Lagrangian of kinetic and potential energies L(q. however the first term contains the variation of the derivative. ! ∂T ∂V d ∂T − + = 0. Z t2 (X " ∂T t1 i ∂T ∂V δ q˙i + δqi − δqi ∂ q˙i ∂qi ∂qi #) dt = 0 We wish to factor out the independent variations δqi ..

jpg JCF_Gauss.jpg Sir Isaac Newton Jean-Baptiste le Rond d’Alembert Joseph-Louis Lagrange Carl Fredrich Gauss William Rowan Hamilton 1642-1727 1717-1783 1736-1813 1777-1855 1805-1865 Second Law 1687 d’Alembert’s Principle 1743 M´echanique Analytique 1788 Gauss’s Principle 1829 Hamilton’s Principle 1834-1835 fi dt = d(mi vi ) (fi − mi ai )δri = 0 P d ∂L dt ∂ q˙i − ∂L ∂qi = Qi G = 12 (¨ q − a)T M(¨ q − a) δG = 0 R t2 S = t1 L(q. Structural Dynamics – Duke University – Fall 2016 – H. Gavin 7 A Little History I_Newton.jpg JR_dAlembert.jpg JL_Lagrange.jpg WR_Hamilton.6 CEE 541.P. ˙ t)dt δS = 0 CC BY-NC-ND HP Gavin . q.

(36) These last two equations represent a pair of coupled nonlinear ordinary differential equations describing the unconstrained motion of an elastic pendulum. ˙ = M ((l + u)θ) 2 2 (27) 1 V (θ. and acceleration of the generalized coordinates. velocity. 1 ˙ u) ˙ 2 + 1 M u˙ 2 T (θ. u. u) = M g(l − (l + u) cos θ) + Ku2 2 (28) Lagrange’s equations require the following derivatives (where q1 = θ and q2 = u): d ∂T d ∂T = dt ∂ q˙1 dt ∂ θ˙ ∂T ∂T = ∂q1 ∂θ ∂V ∂V = ∂q1 ∂θ d ∂T d ∂T = dt ∂ q˙2 dt ∂ u˙ ∂T ∂T = ∂q2 ∂u ∂V ∂V = ∂q2 ∂u = d ˙ = M (2(l + u)u˙ θ˙ + (l + u)2 θ) ¨ (M (l + u)2 θ) dt (29) = 0 (30) = M g(l + u) sin θ (31) = d M u˙ = M u¨ dt (32) = M (l + u)θ˙2 (33) = Ku − M g cos θ (34) Substituting these derivatives into Lagrange’s equations for q1 gives ¨ + M g(l + u) sin θ = 0 . t) q ¨(t) = Q(q(t). M (2(l + u)u˙ θ˙ + (l + u)2 θ) (35) Substituting these derivatives into Lagrange’s equations for q2 gives M u¨ − M (l + u)θ˙2 + Ku − M g cos θ = 0 . They may be written in matrix form as " #" # " # M (l + u)2 0 −M g(l + u) sin θ − M 2(l + u)u˙ θ˙ θ¨ = (37) 0 M u¨ M (l + u)θ˙2 − Ku + M g cos θ or M(q(t). q(t). it is much easier to express the kinetic energy and the potential energy in terms of θ and u than x and y.7 Generalized Coordinates and Lagrange’s Equations 8 Example: an elastic pendulum For an elastic pendulum (a mass swinging on the end of a spring). CC BY-NC-ND HP Gavin . and can involve position. By carefully relating forces in Cartisian coordinates to those in generalized coordinates through free-body diagrams the same equations of motion may be derived. but doing so with Lagrange’s equations is often more straight-forward once the kinetic and potential energies are derived. the inertial terms (involving mass) are more complicated than just M r¨. θ. ˙ t) (38) As can be seen.

/d \ p := -C |-. Structural Dynamics – Duke University – Fall 2016 – H.u(t)| + f(t) \dt / The lines above setup Maple to invoke the desired functional notation.u(t) dt > T := (1/2) * M * vˆ2. and the work of non-conservative forces and external forcing. and the external and non-conservative forces p. W . 2 V := 1/2 K u(t) > p := -C * diff(u(t). define the velocities v as the derivatives of time-dependent displacements u(t). Here are the Maple commands: > with(Physics): > Setup(mathematicalnotation=true) > v := diff(u(t). /d \2 T := 1/2 M |-. but with some linear viscous damping in parallel with the spring.P. potential energy V. CC BY-NC-ND HP Gavin . and represent the kinetic energy T.t). basically the same as the elastic pendulum with just the u(t) coordinate. potential energy V . The subsequent lines evaluate the derivatives and combine the derivatives into Lagrange’s equations to give us the equations of motion.1 A forced spring-mass-damper oscillator Consider a forced mass-spring-damper oscillator . collocated with the displacement u(t). The Maple software may be used to apply Lagrange’s equations to these expressions for kinetic energy. u) ˙ = where (p δu) is the work of real non-conservative forces through a virtual displacement δu. d v := -. 1 M u(t) ˙ 2 2 1 V (u) = Ku(t)2 2 p(u.u(t)| \dt / > V := (1/2) * K * u(t)ˆ2. u) ˙ δu = −cu(t) ˙ δu + f (t) δu T (u.8 CEE 541. . (without the θ coordinate). . in which the damping force is cu˙ and the external driving force is f (t). T . and external forcing f (t).t) + f(t) . Gavin 9 Maple software to compute derivatives for Lagrange’s equations 9.

.u(t)). v). giving us the expected equation of motion (EOM) .u(t)).u(t)| \dt / > ddt_dTdv := diff(dTdv.u(t)| + K u(t) = -C |-.u(t)| | 2 | \dt / > dTdu := diff(T. . /d \ Q := -C |-. . dTdu := 0 > dVdu := diff(V.9 Generalized Coordinates and Lagrange’s Equations > dTdv := diff(T. dVdu := K u(t) > Q := p*diff(u(t). / 2 \ |d | ddt_dTdv := M |--. /d \ dTdv := M |-. .dTdu + dVdu = Q.u(t)).u(t)| + f(t) \dt / > EOM := ddt_dTdv .u(t)| + f(t) | 2 | \dt / \dt / > quit . M u¨(t) + C u(t) ˙ + Ku(t) = f (t) CC BY-NC-ND HP Gavin . / 2 \ |d | /d \ EOM := M |--.t).

Structural Dynamics – Duke University – Fall 2016 – H.t).(l+u(t)) * cos(q(t))) + (1/2) * K * u(t)ˆ2. > with(Physics): > Setup(mathematicalnotation=true) > v1 := diff(q(t). d v1 := -. d v2 := -.q(t) dt > v2 := diff(u(t). called u(t) in Maple. .10 CEE 541. CC BY-NC-ND HP Gavin .u(t) dt > T := (1/2) * M * (( l+u(t))*v1)ˆ2 + (1/2) * M * v2ˆ2.u(t)| \dt / \dt / > V := M * g * ( l .diff(T.u(t)| + M (l + u(t)) |--.u(t)| .v1) .q(t)| \dt / \dt / | 2 | \dt / + M g (l + u(t)) sin(q(t)) > EOM2 := diff( diff(T. the first coordinate is θ(t).q(t)).(l + u(t)) cos(q(t))) + 1/2 K u(t) > EOM1 := diff( diff(T. Gavin 9. 2 V := M g (l .P.u(t)) + diff(V.2 An elastic pendulum For the elastic pendulum problem considered earlier.q(t)| .M (l + u(t)) |-. t) .q(t)| |-. The second coordinate is u(t) . t) . .q(t)| + 1/2 M |-. / 2 \ |d | /d \2 EOM2 := M |--.q(t)) + diff(V.v2) .M g cos(q(t)) + K u(t) | 2 | \dt / \dt / > quit The Maple expressions EOM1 and EOM2 are the same equations of motion as the previouslyderived equations (35) and (36).t). and is called q(t) in the Maple commands.u(t)).diff(T. / 2 \ /d \ /d \ 2 |d | EOM1 := 2 M (l + u(t)) |-. 2 /d \2 /d \2 T := 1/2 M (l + u(t)) |-.

TV ] = ode4u ( ’ e l a s t i c _ p e n d u l u m _ s y s ’ .0.0. theta_dot_o .:). % % % % initial initial initial initial r o t a t i o n angle spring stretch r o ta t io n rate . kg 16 17 18 f p r i n t f ( ’ spring . rad . points = f l o o r ( t_final / delta_t ). ˙ T . x = In general.:).mass frequency = % f Hz \ n ’ .x . and u in this example). m/ s ˆ2 e l a s t i c s p r i n g c o n s t a n t . e p s epsPlots = 0. = 1.02. = 9. N/m pendulum mass . 41 42 43 % kinetic energy % p o t e n t i a l energy 44 45 % c o n v e r t from ” q ” c o o r d i n a t e s t o ” r ” c o o r d i n a t e s . ¨ u¨]T is written as a function of the state.11 Generalized Coordinates and Lagrange’s Equations 10 Matlab simulation of an elastic pendulum To simulate the dynamic response of a system described by a set of ordinary differential equations. m rad / s r a t e . 7 8 % s ys t e m c o n s t a n t s a r e g l o b a l v a r i a b l e s . lower-order derivatives (θ. θ.:). i f epsPlots . un−s t r e t c h e d l e n g t h o f t h e pendulum . m g r a v i t a t i o n a l a c c e l e r a t i o n . u_o . sqrt ( g / l )/(2* pi )) 19 20 21 22 23 t_final = 36. = TV (2 .* cos ( theta ). T V = TV (1 . l. the system equations may be written in a state variable form. the state derivative x˙ = [θ.:). in which the highestorder derivatives of each equation (θ¨ and u¨ in this example) are written in terms of the ˙ u.5. 1 2 % elastic pendulum sim % s i m u l a t e t h e f r e e r e s p o n s e o f an e l a s t i c pendulum 3 4 5 6 % f o r m a t and e x p o r t p l o t i n . % eq ’ n ( 1 ) % eq ’ n ( 2 ) CC BY-NC-ND HP Gavin . e l s e formatPlot (0). the equations of motion are re-expressed as θ¨ = −(2u˙ θ˙ + g sin θ)/(l + u) (39) 2 u¨ = (l + u)θ˙ − (K/M )u + g cos θ (40) ˙ u. m/ s 31 32 % initial x_o = [ theta_o . x (2 . ˙ θ. ˙ u] [θ. state 33 34 35 % s o l v e t h e e q u a t i o n s o f motion [t . 46 47 48 x = ( l + u ). spring stretch . u_dot_o ].:). = 25. 0.8. formatPlot (14 . s number o f d a t a p o i n t s time data . x (3 . x (4 .. In this example. 9 10 global l g K M 11 12 13 14 15 l g K M % % % % = 1. 0. x(t) ˙ = f (t.0..6.. The equations of motion are written in this way in the following Matlab simulation. end animate = 1.. x). ˙ θ. The set of lower-order derivatives is called the state vector. t .:). s time s t e p increment . delta_t = 0. s 24 25 % i n i t i a l conditions 26 27 28 29 30 theta_o u_o theta_dot_o u_dot_o = = = = 0. % % % % simulation duration . 36 37 38 39 40 theta u theta_dot u_dot = = = = x (1 . x_o ).0. y = -( l + u ).5). sqrt ( K / M )/(2* pi )) f p r i n t f ( ’ pendulum frequency = % f Hz \ n ’ . u.* s i n ( theta ). t = [1: points ]* delta_t . dxdt .

E . x ) % s ys t e m e q u a t i o n s f o r an e l a s t i c pendulum % compute t h e s t a t e d e r i v a t i v e . Structural Dynamics – Duke University – Fall 2016 – H. theta_ddot . u_ddot ].E.TV] = e l a s t i c p e n d u l u m s y s ( t .* cos ( theta )) + (1/2) * K * u . x ) % [ d x d t . % eq ’ n ( 3 5 ) 21 22 u_ddot = ( l + u )* theta_dot ˆ2 - ( K / M )* u + g * cos ( theta ). TV ] = e l a s t i c _ p e n d u l u m _ s y s (t . % P. % eq ’ n ( 3 6 ) 23 24 % assemble the s t a t e d e r i v a t i v e 25 26 dxdt = [ theta_dot .ˆ2 + (1/2) * M * u_dot . T. x (4). x (3).* theta_dot ). ( 2 5 ) M * g *( l -( l + u ). (26) 30 31 32 % −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− e l a s t i c p e n d u l u m s y s CC BY-NC-ND HP Gavin . 8 9 global l g K M 10 11 % define the state vector 12 13 14 15 16 theta u theta_dot u_dot = = = = x (1). o f an e l a s t i c pendulum .ˆ2 ]. spring stretch .12 1 2 3 4 5 CEE 541.. m/ s 17 18 % compute t h e a c c e l e r a t i o n o f t h e t a and u 19 20 theta_ddot = -(2* u_dot * theta_dot + g * s i n ( theta )) / ( l + u ). t h e k i n e t i c energy . m rad / s r a t e . % K.. 6 7 % s ys t e m c o n s t a n t s a r e pre−d e f i n e d g l o b a l v a r i a b l e s . rad . % % % % r o t a t i o n angle spring stretch r ot a ti on rate . 27 28 29 TV = [ (1/2) * M * (( l + u ). Gavin function [ dxdt .ˆ2 . x (2). and t h e % p o t e n t i a l energy .P. u_dot . V. d x d t .

the least rational number. u(0)) in this example? About what values do θ(t) and u(t) oscillate for t > 0? (spyrograph!) CC BY-NC-ND HP Gavin .5 swing.5 1 x position. m -1 0 5 10 15 20 energies. Even though Tk /Tl ≈ ( 5 − 1)/2. 0 5 10 15 20 time.007 s. Tk = 2π M/K = 1. the sum of kinetic energy and potential energy is constant. s 0 t = 36.E.E.5 -1 -1. Why is it that the internal potential energy becomes negative as compared to it’s initial value? What is the initial configuration of the system (θ(0). K. p θ(0) of 2 0. y0) -1 -0. g = 9. s 6 5 4 3 2 1 0 -1 -2 K.E.000 s y position. P. Joules time. and M√= 1 kg. m ˙ Figure 1. K = 25.E. q1(t) = θ(t).6 N/m. q2(t) = u(t). Tl = 2π l/g = 2.5 0 -0.5 -2 (x0.13 Generalized Coordinates and Lagrange’s Equations 1 θ(t) and u(t) 0.+P. the record repeats every 24 seconds.5 0 0.5 rad/s for l = 1.8 m/s . rad stretch.242 s.0 p m. m -0. Note that in the absence of internal damping and external forcing. Free response of an elastic pendulum from an initial rotational velocity.

Gavin 11 Constraints Suppose that in a dynamical system described by m generalized dynamic coordinates. ˙ g(q(t).14 CEE 541. u(t)) ≤ 0. • A system with constraints that depend only on the position of the coordinates. t) = 0 ˙ (in which g(q(t). The required constraint forces QC are collocated with the generalized coordinates q. u(t)) = 0. • A system with constraints that are independent of time. t) can not be integrated into a holonomic form) is non-holonomic.. q) is scleronomic. · · · . or that the pendulum can not move past a particular line. For example. and the virtual work of the constraint forces acting through virtual displacements is zero5 QC · δq = 0. q(t) = h q1 (t). q2 (t). suppose the elastic pendulum must move along a particular line. q(t). then the system (including the differential equations and the constraints) is called a holonomic system. • A system with constraints that are explicitely dependent on time. There are a number of intriguing terms connected to constrained dynamical systems. 5 Lanczos. g(θ(t). q(t). • A system with constraints that are linear in the velocities. 4th ed. If these constraints to the motion of the system can be written pureley in terms of the positions of the coordinates. t) = 0 is holonomic. C. • A system with constraints that depend on the position and velocity of the coordinates. g(q(t). g(θ(t). Structural Dynamics – Duke University – Fall 2016 – H. Geometrically. The Variational Principles of Mechanics. Dover 1986 CC BY-NC-ND HP Gavin . as in the constraints listed under the first two definitions is rheonomic.P.. g(q) = 0 or ˙ =0 g(q. qm (t) i there are specific requirements on the motion that must be satisfied. q(t)) = f (q(t)) · q(t) is pfafian. Any unconstrained system must be forced to adhere to a prescribed constraint. the constraint forces are normal to the displacement variations. ˙ ˙ g(q(t).

g(q) = 0. must lie along the curve 1 − θ2 − u/l = 0.1 Holonomic systems Consider a constraint for the elastic pendulum in which the pendulum must move along a curve g(θ(t). (41) A constraint evaluated at a perturbed solution q + δq. This is a perfectly acceptable means of incorporating holonomic constraints into an analysis. in general. CC BY-NC-ND HP Gavin . In order for the variation δq to be admissible. it needs to be forced. For example. δu]. In other words. the constraint force must lie within [∂g/∂q]. incorporating a constraint can be as simple as solving the constraint equation for one of the variables. " C Q =λ T ∂g ∂q # . t) + δq + h. ⇐⇒ Clearly the elastic pendulum will not follow the path g = 0 all by itself.o. For example. Recall that an admissible variation. u(t) = l − lθ2 (t) and using the constraint to eliminate one of the coordinates. for example. consider the constraint u(t) = l − lθ2 (t) g(θ(t). perterbued by [δθ.15 Generalized Coordinates and Lagrange’s Equations 11. For relatively simple systems such as this. the variation δq must be perpendicular to the gradient of g with respect to q. somehow. u(t)) = 1 − θ2 (t) − u(t)/l . t) = g(q. to follow the prescribed trajectory. The guide exerts constraint forces QC in a direction transverse to the guide. θ. With the substitution of u(t) = l − lθ2 (t) into the expressions for kinetic energy and potential energy. Because admissible variations δq are normal to [∂g/∂q] and the constraint force QC is normal to δq. the perturbed solution must also lie on the line of the constraint. . and therefore misses an important aspect of the behavior of the system. can be approximated via a truncated Taylor series " # ∂g g(q + δq. a set of c constraint equations g(q) = 0 can not be re-arranged to express the position of c coordinates in terms of the remaining (m − c) coordinates. in general. Furthermore. reducing the dimension of the system by using the constraint equation to eliminate variables does not give us the forces required to enforce the constraints. u(t)) = 0. ∂q The constraints at the perturbed solution are satisfied for infinitessimal pertubations as long as equation (41) holds. So a more general approach is required to derive the equations of motion for constrained systems.t. but not along the guide. the solution to the constrained elastic pendulum. In a holonomic system (in which the constraints are on the coordinate positions) it can be helpful to think of a frictionless guide that enforces the dynamics to evolve along a partiular line. Lagranges equations can be written in terms of the remaining coordinate. " ∂g ∂q # δq = 0 . However. δq must adhere to all constraints.

d dt ∂T ∂ q˙j ! − X ∂gi ∂V ∂T + − λi − Qj = 0 ∂qj ∂qj ∂qj i in which X i λi (42) ∂gi ∂qj is the generalized force on coordinate qj applied through the system of constraints. can be found. and the Lagrange multipliers. Admissibile variations δq for holonomic (left) and non-holonomic (right) systems. CC BY-NC-ND HP Gavin . t) = 0 . . Structural Dynamics – Duke University – Fall 2016 – H. In holonomic systems δq need only be normal to ∂g/∂ q. C λ(t). 1 . Q (t). q q 2 2 dg dq dg . In holonomic systems δq adheres to the constraint g(q) = 0 since δq is normal to the gradient of ˙ g with respect to q. g(q . q ) = 0 1 2 1 2 1 2 Figure 2. The constraint forces QC j may now be added into Lagrange’s equations as the forces required to adhere the motion to the constraints gi (q) = 0.P. q ) = 0 q q 1 g(q . Gavin . q . q . (43) These forces are precisely the actions that enforce the constraints.16 CEE 541. g(q. Equations (42) and (43) uniquely describe the dynamics of the system. q ¨(t). from which the constraint forces. dq δq δq . In numerical simulations these two systems of equations are solved simultaneously for the accelerations.

a solution can be found.17 Generalized Coordinates and Lagrange’s Equations Let’s apply this to the elastic pendulum. . But in this problem the constraint equation is in terms of positions θ and u. In solving the equations of motion numerically. and therefore two generalized constraint forces. and λ. (This problem has one constraint. M (l + u)2 θ¨ + 2θλ = −M g(l + u) sin θ − M 2(l + u)u˙ θ˙ 1 M u¨ + λ = M (l + u)θ˙2 − Ku + M g cos θ l ¨ 2lθθ + u¨ = −2lθ˙2 (48) (49) (50) The constraint force in the θ direction is λ(2θ) and the constraint force in the u direction is λ/l. 2lθθ¨ + u¨ = −2lθ˙2 . The constraint equation(s) give(s) the additional equation(s) to do so.) There are no other non-conservative forces Qj applied to this system. as a system of firstorder o.e’s. So doing. lθ02 + u0 = l 2lθ0 θ˙0 + u˙ 0 = 0 (52) (53) These equations can be integrated numerically as was shown in the previous Matlab example. In the case of constrained dynamics.     −M g(l + u) sin θ − M 2(l + u)u˙ θ˙ M (l + u)2 0 2θ θ¨      0 M 1/l  ¨  =  M (l + u)θ˙2 − Ku + M g cos θ    u 2θ 1/l 0 λ −2θ˙2  (51) Note that the initial condition of the system must also adhere to the constraints. except for the fact that in the presence of constraints. we solve for the highest order derivitives in each equation in terms of the lower-order derivitives. constrained to move along a path u(t) = l − lθ2 (t) ⇐⇒ g(θ(t). and the new term for the constraint force in the u direction in equation (36) is +λ(1/l). with some rearrangement. However. (47) ¨ u¨. CC BY-NC-ND HP Gavin . the accelerations and Lagrange multiplier need to be evaluated as a solution of three equations with three unknowns. but two coordinates. The problem now involves three equations (two equations of motion and the constraint) and three unknowns θ. Now we have three equations and three unknowns for θ. (44) The derivitives of T and V are as they were previously. λ. u (or their derivitives) and λ. +λ(2θ). u(t)) = 1 − θ2 (t) − u(t)/l . The three equations may be written in matrix form .d. In this case the highest order derivitives are θ¨ and u¨. . and therefore one Lagrange multiplier. The new derivitives required to model the actions of the constraints are ∂g ∂g = = −2θ (45) ∂q1 ∂θ ∂g ∂g = = −1/l (46) ∂q2 ∂u Equation (35) now includes a new term for the constraint force in the θ direction. In principle. we also need to solve for the Lagrange multiplier(s). by differentiating the constraint we can put this in terms of accelerations θ¨ and u¨.

CC BY-NC-ND HP Gavin .5 -1 swing. 4 3 2 1 0 0 5 10 15 20 time. Joules 5 K. rad stretch. Qθ u constraint force. K.E.E.P.+P. y0) -1 -0.5 -2 (x0.000 s y position. The constrained motion of the pendulum is seen to satisfy the equation u = l − lθ2 for l = 1 m. Gavin θ(t) and u(t) 1 0.18 CEE 541. s energies.5 0 5 10 15 20 time. m -1.5 0 -0.5 -1 -1. 0 t = 20.5 1 x position. The motion is periodic and the total energy is conserved exactly. 15 10 5 0 -5 θ constraint force. q2(t) = u(t). Qu -10 0 5 10 15 20 Figure 5. Structural Dynamics – Duke University – Fall 2016 – H. s Figure 3. The constraint forces in the θ (blue) and u (green) directions required to enforce the constraint u(t) = l − lθ2 (t).E.5 0 0. P.E. m Figure 4. Free response of an undamped elastic pendulum from an initial condition uo = l and θ˙o = 1 constrained to move along the arc u = l − lθ2 . q1(t) = θ(t). m -0.

D. ˙ t) + ∂q ∂ q˙ So. the constraint forces QC in non-holonomic systems do no work through the displacement variations. Rolling Isolation Systems: Modeling. Physics 73(3) 265-272 (2005) 8 M. It may be shown6 that this condition is equivalent to " ∂g ∂ q˙ # · δq = 0 (55) which is the constraint on the displacement variations for non-holonomic systems. ∂q ∂ q˙ # " · δq δ q˙ # =0. ˙ " QC = λ T ∂g(q. " ∂g ∂g . Duke Univ. (54) The constraint forces QC ˙ = 0. “The enigma of nonholonomic constraints. “d’Alembert-Lagrange analytical dynamics for nonholonomic systems. ˙ t) = g(q. Since admissible variations δq are normal to [∂g/∂ q]. Equations (54) and (56) uniquely prescribe the constraint forces (Lagrange multipliers λ) and the dynamics of a system constrained by a function of velocity and displacement. ˙ t) = 0 . Ph. Flannery. for infinitessimal variations. = 0 g(q + δq. q˙ + δ q. ∂qj ∂qj ∂ q˙j i in which X i λi (56) ∂gi ∂ q˙j is the generalized force on coordinate qj applied through the system of constraints g = 0. Harvey. Jr. ˙ the constraint forces must therefore lie within [∂g/∂ q]. q.19 Generalized Coordinates and Lagrange’s Equations 11.78 d dt ∂T ∂ q˙j ! − X ∂gi ∂T ∂V + − λi − Qj = 0 . q. Including these constraint forces into Lagrange’s equations gives the non-holonomic form of Lagrange’s equations. 2013 7 M. δq.R.. dissertation. Flannery.o. g(q.R. q) ˙ ∂ q˙ # . and Assessment.” Am. As in holonomic constraints.” J.t. q. Mathematical Physics 52 032705 (2011) CC BY-NC-ND HP Gavin . J. As always.2 Non-holonomic systems A non-holonomic system has internal constraint forces QC j which adhere the responses to a non-integrable relationship involving the positions and velocities of the coordinates.t) admissible variations must satisfy the constraints # " " # ∂g ∂g δq + δ q˙ + h. Analysis. any j are normal to the constraint surface g(q.S. 6 P.

suppose the dynamics of the elastic pendulum are controlled by some internal forces so that the direction of motion arctan(dy/dx) is actively steered to an angle φ that is proportional to the stretch in the spring. M (l + u)2 θ¨ − (ls)λ = −M g(l + u) sin θ − M 2(l + u)u˙ θ˙ M u¨ + (c)λ = M (l + u)θ˙2 − Ku + M g cos θ −(ls)θ¨ + (c)¨ u = lθ˙2 c + θ˙u(s ˙ + bc) + bu˙ 2 s/l with an initial condition that also satisfies the constraint. ¨ − θ˙u(s g˙ = −bu˙ 2 s/l + u¨c − lθ˙2 c − lθs ˙ + bc) (60) Our three equations are now. Furthermore. giving the constraint. the constraint forces are dependent upon the position of the pendulum (θ and u). CC BY-NC-ND HP Gavin . −λ(ls). Since. we can differentiate the constraint equation to transform it into accelerations. we are interested in solving for the ¨ and u¨(t). The equations may be written in matrix form . θ. u. and λ(t).      −M g(l + u) sin θ − M 2(l + u)u˙ θ˙ M (l + u)2 0 −l sin θ θ¨      0 M cos θ  ¨  =  M (l + u)θ˙2 − Ku + M g cos θ    u −l sin θ cos θ 0 λ lθ˙2 c + θ˙u(s ˙ + bc) + bu˙ 2 s/l (61) (62) (63) three (64) Note that the upper-left 2 × 2 blocks in the matrices of equations (51) and (64) are the same as the corresponding matrix M in the unconstrained system (37). φ = −bu/l. . u˙ ˙ u) = tan(θ + bu/l) ⇐⇒ g(θ. u(t).20 CEE 541. but not on the velocities. where s = sin(θ + bu/l) and c = cos(θ + bu/l). q(t)) g ˙ q ¨(t) − b(q(t). for numerical simulation purposes. which provides an appealing interpretation of constrained dynamical systems. ˙ t) then both equations (51) and (64) may be written " M AT A 0 #" q ¨ λ # " = Q b # . Gavin As an example. The constraint equation along with the equations of motion uniquely define the solution θ(t). Note that in this case. The same is true for the first two elements of the right-hand-side vectors of equations (51) and (64) and the right-hand-side vector Q of the unconstrained system (37). θ(t) a form that is linear in the accelerations. Structural Dynamics – Duke University – Fall 2016 – H. q(t). u˙ 0 = lθ˙0 tan(θ + bu/l).P. . The velocity transvese to the steered angle must be zero. (65) This expression can be obtained directly from Gauss’s principle of least constraint. if the differentiated constraint equations (47) and (60) are written as ˆ = A(q(t). ˙ = u˙ cos(θ + bu/l) − lθ˙ sin(θ + bu/l) (57) lθ˙ The additional derivitives required for the non-holonomic form of Lagranges equations are ∂g ∂g = ˙ = −l sin(θ + bu/l) (58) ∂ q˙1 ∂θ ∂g ∂g = = cos(θ + bu/l) (59) ∂ q˙2 ∂ u˙ Equation (35) now includes a new term for the constraint force in the θ direction. and the new term for the constraint force in the u direction in equation (36) is +λ(c).

m Figure 7.5 x position. The constraint forces in the θ (blue) and u (green) directions required to enforce ˙ u˙ = tan(θ + bu/l). q1(t) = θ(t).5 0 0. with b = 5. Joules time. The constrained motion of the pendulum does not follow a fixed relation between u and θ — the constraint is non-holonomic. y0) -1 -0.2 rad.000 s -0. the constraint lθ/ CC BY-NC-ND HP Gavin . rad stretch.5 1 1. s Figure 6. m -1 0 5 10 15 20 25 30 35 40 energies.E. 2 1. Qu -250 0 5 10 15 20 25 30 35 40 Figure 8. 0 5 10 15 20 25 30 35 40 time. ˙ u˙ = tan(θ + bu/l).21 Generalized Coordinates and Lagrange’s Equations 1 θ(t) and u(t) 0.5 -1 -1.5 -2 -1.5 swing.5 (x0.+P. θ˙o = 1 rad/s.5 0 t = 40. Free response of an undamped elastic pendulum from an initial condition uo = l/2. with trajectory constrained by lθ/ The motion is not periodic but total energy is conserved exactly and the constraint is satisfied at all times.5 0 -0.E. θo = 0. q2(t) = u(t). P.E.5 y position. (ying & yang) 100 50 0 -50 -100 -150 -200 θ constraint force. Qθ u constraint force. s 5 4 3 2 1 0 -1 -2 K. m 1 0.E. K.

R. 4:232-235. Mathematical and Physical Sciences. M(q.”.P. A 0 λ b 9 Hofrath and Gauss. The constrained system requires additional actions QC to enforce the constraint. and Kalaba. “A New Perspective on Constrained Motion. so the equations of motion of the constrained system are M(q. q.22 CEE 541. Structural Dynamics – Duke University – Fall 2016 – H. C. " #" # " # M AT q ¨ Q = . Gavin 12 Gauss’s Principle of Least Constraint Consider the equations of motion of the unconstrained system written as equation (38). ˙ t) + QC (q. define a quadratic form of the accelerations. 1 (¨ q − a)T M (¨ q − a) + λT (A q ¨ − b) (66) GA = 2 1 T 1 = q ¨ M¨ q+q ¨T Ma + aT Ma + λT A¨ q − λT b 2 2 minimized with respect to q ¨. q. J. To minimize a quadratic objective subject to a linear constraint the objective can be augmented via Lagrange multipliers λ. “Uber ein Neues Allgemeines Grundgesatz der Mechanik. Define the accelerations of the unconstrained system as a ≡ M−1 Q and write the differentiated constraints as A(q. 439(1906):407-410. t) q ¨ = Q(q. CC BY-NC-ND HP Gavin . as derived earlier for both holonomic and nonholonomic systems. F. q.E.E. q. ∂GA ∂¨ q !T ⇐⇒ =0 M¨ q = Q − AT λ (67) A¨ q=b (68) and maximized with respect to λ. ˙ t) .” Proc. The matrix M is assumed to be symmetric and positive definite. Reine Angewandte Mathematik. (1829) 10 Udwadia. Lastly. 1 G = (¨ q − a)T M (¨ q − a) 2 Gauss’s Principle of Least Constraint910 states that the accelerations of the constrained system q ¨ minimize G subject to the constraints A¨ q = b. ∂GA ∂λ !T =0 ⇐⇒ These conditions are met in equation (65). ˙ t) . ˙ t) q ¨ = b(q.. t) q ¨ = Q(q. q.F. (1992). ˙ t).. The naturally-constrained accelerations q ¨ are as close as possible to the unconstrained accelerations a in a least-squares sense and at each instant in time while satisfying the constraint A¨ q = b.

QC = −AT λ.23 G( q"1(t). and substituting a = M−1 Q. the constraint force. AM−1 Q − AM−1 AT λ = b the Lagrange multipliers may be found. can be found as well. The constrained minimum of the quadratic objective G gives the correct equations of motion. QC = −AT λ. it is also useful in building an understanding of their nature. The matrix K = −AT (AM−1 AT )−1 is a kind of natural nonlinear feedback gain matrix that relates the constraint violation of the unconstrained accelerations (Aa − b) to the constriant force required to bring the constraint to zero. λ = −(AM−1 AT )−1 (b − AM−1 Q) . q"2(t) ) Generalized Coordinates and Lagrange’s Equations Aq"=b a2(t) q"2(t) fC(t)=-AT y a1(t) q"1(t) The force of the constraints is now apparent. QC = −AT (AM−1 AT )−1 (Aa − b) . or QC = K(Aa − b) . CC BY-NC-ND HP Gavin . Solving the first of the equations for q ¨. While equation (65) is sufficient for analyzing the behavior and simulating the response of constrained dynamical systems. If the unconstrained accelerations satisfy the constraint. QC . The difference (Aa − b) is the amount of the constraint violation associated with the unconstrained accelerations a. then the constraint force is zero. q ¨ = M−1 Q − M−1 AT λ and inserting this expression into the constraint equation.