Вы находитесь на странице: 1из 23

Generalized Coordinates, Lagranges 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. Lets define


"

r(t) =

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) =

r1 (t)
r2 (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

x =

(6)
(7)

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 ri (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 ri +
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 ri (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 dAlembert-Lagrange
equations, the same as equation (8) found from the principle of virtual displacements,
n
X
i=1

V
M ri (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 ri (t) +

V
pi (t) = 0 .
ri

(13)

dAlembert, 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 Lagranges equations potential energy
is assigned the variable V and kinetic energy is denoted by T .
2

CC BY-NC-ND HP Gavin

Generalized Coordinates and Lagranges Equations

4 Derivation of Lagranges equations from f = ma


For many problems equation (13) is enough to determine equations of motion. However,
in coordinate systems where the kinetic energy depends on the position and velocity of
some generalized coordinates, q(t) and q(t),

expressions for inertial forces become more


complicated.
P

The first goal, then, is to relate the work of inertial forces ( i M ri ri ) to the kinetic
energy in terms of a set of generalized coordinates. To do this requires a change of coordinates
from variations in n Cartesian coordinates r to variations in m generalized coordinates q,
ri =

m
X
ri
ri
qj =
qj
j=1 qj
j=1 qj
m
X

and

m
X
d
ri
ri = ri =
qj .
dt
j=1 qj

(14)

Now, consider the kinetic energy of a constant mass M . The kinetic energy in terms of
velocities in Cartesian coordinates is given by T (r) = 12 M (r12 + r22 ), and
T
ri = M ri ri .
ri

(15)

Applying the product and chain rules of calculus to equation (15),


d
dt

T
ri
ri

= M ri ri + M ri

d
ri
dt

(16)

m
d T X
ri
T
qj
= M ri ri +
ri
dt ri j=1 qj
ri

M ri ri

(17)

m
m
ri T X
ri
d T X
=
qj
qj .
dt ri j=1 qj
ri j=1 qj

(18)

Equation (18) is a step to getting the work of inertial forces ( i M ri ri ) in terms of a set of
generalized coordinates qj . Next, changing the derivatives of the potential energy from ri to
qj ,
m
X
V
V qj ri
ri =
qj .
(19)
ri
j=1 qj ri qj
Finally, expressing the work of external forces pi in terms of the new coordinates qj ,
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 ,
qj
j=1 qj
j=1 i=1
j=1

(20)

where Qj (t) are called generalized forces. Substituting equations (18), (19) and (20) into
equation (12), rearranging the order of the summations, factoring out the common qj ,
canceling the ri and ri terms, and eliminating the sum over i, leaves the equation in terms
CC BY-NC-ND HP Gavin

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

of qj and qj ,
n
X

m
m
m
m
X
X
ri T X
ri
V qj ri
ri
d T X

qj
qj +
qj pi (t)
qj = 0
dt

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 ri
ri qj

T ri V qj ri
ri

+
pi
ri qj qj ri qj
qj
m
X
j=1

"

d
dt

T
qj

T
V

+
Qj
qj qj

qj = 0
#

qj = 0

The variations qj must be arbitrary and independent of one another; this equation must
hold for each generalized coordinate qj individually. Removing the summation over j and
canceling out the common qj factor results in Lagranges equations,3
d
dt

T
qj

V
T
+
Qj = 0
qj qj

(21)

are which are applicable in any coordinate system, Cartesian or not.

5 The Lagrangian
Lagranges equations may be expressed more compactly in terms of the Lagrangian of
the energies,
L(q, q,
t) T (q, q,
t) V (q, t)
(22)
Since the potential energy V depends only on the positions, q, and not on the velocities, q,

Lagranges equations may be written,


d
dt

L
qj

L
Qj = 0
qj

(23)

Lagrange, J.L., Mecanique analytique, Mm Ve Courcier, 1811.


CC BY-NC-ND HP Gavin

Generalized Coordinates and Lagranges Equations

6 Explanation of Lagranges equations in terms of Hamiltons principle


Define a Lagrangian of kinetic and potential energies
L(q, q,
t) T (q, q,
t) V (q, t)

(24)

and define an action potential functional


S[q(t)] =

Z t2

L(q, q,
t) dt

(25)

t1

with end points q1 = q(t1 ) and q2 = q(t2 ). 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.
Hamiltons principle:4
The solution q(t) is an extremum of the action potential S[q(t)]
S[q(t)]
=0
Z

t2

L(q, q,
t) dt = 0

t1

Substituting the Lagrangian into Hamiltons principle,


Z t2 (X "
T
t1

T
V
qi +
qi
qi
qi
qi
qi

#)

dt = 0

We wish to factor out the independent variations qi , however the first term contains the
variation of the derivative, qi . If the conditions for admissible variations in position q
fully specify the conditions for admissible variations in velocity q,
the variation and the
differentiation can be transposed,
d
qi = qi ,
(26)
dt
and we can integrate the first term by parts,
Z t2
t1

"

T
T
qi =
qi
qi
qi

#t2

t1

Z t2
t1

d
dt

T
qi dt
qi

Since q(t1 ) = 0 and q(t2 ) = 0,


Z t2 (X "
t1

dt

T
T
V
qi +
qi
qi
qi
qi
qi

#)

dt = 0

The variations qi must be arbitrary, so the term within the square brackets must be zero
for all i.
!
T
V
d T

+
= 0.
dt qi
qi qi

4
Hamilton, W.R., On a General Method in Dynamics, Phil. Trans. of the Royal Society Part II (1834)
pp. 247-308; Part I (1835) pp. 95-144

CC BY-NC-ND HP Gavin

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

7 A Little History

I_Newton.jpg

JL_Lagrange.jpg
WR_Hamilton.jpg
JR_dAlembert.jpg
JCF_Gauss.jpg

Sir
Isaac
Newton

Jean-Baptiste
le Rond
dAlembert

Joseph-Louis
Lagrange

Carl
Fredrich
Gauss

William
Rowan
Hamilton

1642-1727

1717-1783

1736-1813

1777-1855

1805-1865

Second
Law
1687

dAlemberts
Principle
1743

Mechanique
Analytique
1788

Gausss
Principle
1829

Hamiltons
Principle
1834-1835

fi dt = d(mi vi )
(fi mi ai )ri = 0

d L
dt qi

L
qi

= Qi

G = 12 (
q a)T M(
q a)
G = 0
R t2

S = t1 L(q, q,
t)dt
S = 0
CC BY-NC-ND HP Gavin

Generalized Coordinates and Lagranges Equations

8 Example: an elastic pendulum


For an elastic pendulum (a mass swinging on the end of a spring), it is much easier to
express the kinetic energy and the potential energy in terms of and u than x and y.
1
u)
2 + 1 M u 2
T (, u, ,
=
M ((l + u))
2
2

(27)

1
V (, u) = M g(l (l + u) cos ) + Ku2
2

(28)

Lagranges equations require the following derivatives (where q1 = and q2 = u):


d T
d T
=
dt q1
dt
T
T
=
q1

V
V
=
q1

d T
d T
=
dt q2
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 Lagranges equations for q1 gives


+ M g(l + u) sin = 0 .
M (2(l + u)u + (l + u)2 )

(35)

Substituting these derivatives into Lagranges equations for q2 gives


M u M (l + u)2 + Ku M g cos = 0 .

(36)

These last two equations represent a pair of coupled nonlinear ordinary differential equations
describing the unconstrained motion of an elastic pendulum. 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), t) q
(t) = Q(q(t), q(t),

t)
(38)
As can be seen, the inertial terms (involving mass) are more complicated than just
M r, and can involve position, velocity, and acceleration of the generalized coordinates. 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 Lagranges equations is often more straight-forward once the kinetic and potential energies are
derived.
CC BY-NC-ND HP Gavin

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

9 Maple software to compute derivatives for Lagranges equations


9.1 A forced spring-mass-damper oscillator
Consider a forced mass-spring-damper oscillator . . . basically the same as the elastic
pendulum with just the u(t) coordinate, (without the coordinate), but with some linear
viscous damping in parallel with the spring, and external forcing f (t), collocated with the
displacement u(t).
1
M u(t)
2
2
1
V (u) =
Ku(t)2
2
p(u, u)
u = cu(t)

u + f (t) u
T (u, u)
=

where (p u) is the work of real non-conservative forces through a virtual displacement u, in


which the damping force is cu and the external driving force is f (t). The Maple software may
be used to apply Lagranges equations to these expressions for kinetic energy, T , potential
energy V , and the work of non-conservative forces and external forcing, W . Here are the
Maple commands:
> with(Physics):
> Setup(mathematicalnotation=true)
> v := diff(u(t),t);
d
v := -- u(t)
dt
> T := (1/2) * M * v2;
/d
\2
T := 1/2 M |-- u(t)|
\dt
/
> V := (1/2) * K * u(t)2;
2
V := 1/2 K u(t)
> p := -C * diff(u(t),t)

+ f(t) ;
/d
\
p := -C |-- u(t)| + f(t)
\dt
/

The lines above setup Maple to invoke the desired functional notation, define the velocities v as the derivatives of time-dependent displacements u(t), and represent the kinetic
energy T, potential energy V, and the external and non-conservative forces p. The subsequent
lines evaluate the derivatives and combine the derivatives into Lagranges equations to give
us the equations of motion.
CC BY-NC-ND HP Gavin

Generalized Coordinates and Lagranges Equations

> dTdv := diff(T, v);


/d
\
dTdv := M |-- u(t)|
\dt
/
> ddt_dTdv := diff(dTdv,t);
/ 2
\
|d
|
ddt_dTdv := M |--- u(t)|
| 2
|
\dt
/
> dTdu := diff(T,u(t));
dTdu := 0
> dVdu := diff(V,u(t));
dVdu := K u(t)
> Q := p*diff(u(t),u(t));
/d
\
Q := -C |-- u(t)| + f(t)
\dt
/
> EOM := ddt_dTdv - dTdu + dVdu = Q;
/ 2
\
|d
|
/d
\
EOM := M |--- u(t)| + K u(t) = -C |-- u(t)| + f(t)
| 2
|
\dt
/
\dt
/
> quit

. . . giving us the expected equation of motion (EOM) . . .


M u(t) + C u(t)
+ Ku(t) = f (t)

CC BY-NC-ND HP Gavin

10

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

9.2 An elastic pendulum


For the elastic pendulum problem considered earlier, the first coordinate is (t), and is
called q(t) in the Maple commands. The second coordinate is u(t) . . . called u(t) in Maple.
> with(Physics):
> Setup(mathematicalnotation=true)
> v1 := diff(q(t),t);
d
v1 := -- q(t)
dt
> v2 := diff(u(t),t);
d
v2 := -- u(t)
dt
> T := (1/2) * M * (( l+u(t))*v1)2

(1/2) * M * v22;

2 /d
\2
/d
\2
T := 1/2 M (l + u(t)) |-- q(t)| + 1/2 M |-- u(t)|
\dt
/
\dt
/
> V := M * g * ( l - (l+u(t)) * cos(q(t)))

(1/2) * K * u(t)2;

2
V := M g (l - (l + u(t)) cos(q(t))) + 1/2 K u(t)
> EOM1 := diff( diff(T,v1) , t) - diff(T,q(t)) + diff(V,q(t));
/ 2
\
/d
\ /d
\
2 |d
|
EOM1 := 2 M (l + u(t)) |-- q(t)| |-- u(t)| + M (l + u(t)) |--- q(t)|
\dt
/ \dt
/
| 2
|
\dt
/
+ M g (l + u(t)) sin(q(t))

> EOM2 := diff( diff(T,v2) , t) - diff(T,u(t)) + diff(V,u(t));


/ 2
\
|d
|
/d
\2
EOM2 := M |--- u(t)| - M (l + u(t)) |-- q(t)| - 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).
CC BY-NC-ND HP Gavin

11

Generalized Coordinates and Lagranges Equations

10 Matlab simulation of an elastic pendulum


To simulate the dynamic response of a system described by a set of ordinary differential
equations, the system equations may be written in a state variable form, in which the highestorder derivatives of each equation ( and u in this example) are written in terms of the
u,
lower-order derivatives (,
, and u in this example). The set of lower-order derivatives is
called the state vector. In this example, 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,
u]T is written as a function of the state, x =
In general, the state derivative x = [,
,
u]
[, u, ,
T , x(t)

= f (t, x). The equations of motion are written in this way in the following
Matlab simulation.
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 . e p s
epsPlots = 0;
i f epsPlots , formatPlot (14 ,5); e l s e formatPlot (0); end
animate = 1;

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

...

9
10

global

11
12
13
14
15

l
g
K
M

%
%
%
%

= 1.0;
= 9.8;
= 25.6;
= 1.0;

uns 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 , m/ s 2
e l a s t i c s p r i n g c o n s t a n t , N/m
pendulum mass , kg

16
17
18

f p r i n t f ( spring - mass frequency = % f Hz \ n , sqrt ( K / M )/(2* pi ))


f p r i n t f ( pendulum frequency = % f Hz \ n , sqrt ( g / l )/(2* pi ))

19
20
21
22
23

t_final = 36;
delta_t = 0.02;
points = f l o o r ( t_final / delta_t );
t = [1: points ]* delta_t ;

%
%
%
%

simulation duration , s
time s t e p increment , s
number o f d a t a p o i n t s
time data , 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.0;
l;
0.5;
0.0;

%
%
%
%

initial
initial
initial
initial

r o t a t i o n angle
spring stretch
r o ta t io n rate ,
spring stretch

, rad
, m
rad / s
r a t e , m/ s

31
32

% initial

x_o = [ theta_o ; u_o ; theta_dot_o ; u_dot_o ];

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 ,x , dxdt , TV ] = ode4u ( e l a s t i c _ p e n d u l u m _ s y s , t , x_o );

36
37
38
39
40

theta
u
theta_dot
u_dot

=
=
=
=

x (1 ,:);
x (2 ,:);
x (3 ,:);
x (4 ,:);

T
V

= TV (1 ,:);
= TV (2 ,:);

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

...

46
47
48

x = ( l + u ).* s i n ( theta );
y = -( l + u ).* cos ( theta );

% eq n ( 1 )
% eq n ( 2 )

CC BY-NC-ND HP Gavin

12
1
2
3
4
5

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

function [ dxdt , TV ] = e l a s t i c _ p e n d u l u m _ s y s (t , x )
% [ d x d t ,TV] = e l a s t i c p e n d u l u m s y s ( t , 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 , d x d t , t h e k i n e t i c energy , T, and t h e
% p o t e n t i a l energy , V,
o f an e l a s t i c pendulum .

6
7

% s ys t e m c o n s t a n t s a r e pred e f i n e d g l o b a l v a r i a b l e s

...

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);
x (2);
x (3);
x (4);

%
%
%
%

r o t a t i o n angle
spring stretch
r ot a ti on rate ,
spring stretch

, rad
, m
rad / s
r a t e , 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 );

% eq n ( 3 5 )

21
22

u_ddot

= ( l + u )* theta_dot 2

( K / M )* u

g * cos ( theta );

% 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 ; u_dot ; theta_ddot ; u_ddot ];

27
28
29

TV = [ (1/2) * M * (( l + u ).* theta_dot ).2 + (1/2) * M * u_dot .2 ; % K. E . ( 2 5 )


M * g *( l -( l + u ).* cos ( theta )) + (1/2) * K * u .2 ];
% P.E. (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

13

Generalized Coordinates and Lagranges Equations

(t) and u(t)

0.5
0
-0.5

swing, q1(t) = (t), rad


stretch, q2(t) = u(t), m

-1
0

10

15

20

energies, Joules

time, s
6
5
4
3
2
1
0
-1
-2

K.E.
P.E.
K.E.+P.E.

10

15

20

time, s

0
t = 36.000 s

y position, m

-0.5

-1

-1.5

-2

(x0, y0)
-1

-0.5

0.5

x position, m

Figure 1. Free response of an elastic pendulum from an initial rotational velocity,


p (0) of

2
0.5 rad/s for l = 1.0
p m, g = 9.8 m/s , K = 25.6 N/m, and M= 1 kg. Tk = 2 M/K =
1.242 s. Tl = 2 l/g = 2.007 s. Even though Tk /Tl ( 5 1)/2, the least rational
number, the record repeats every 24 seconds. Note that in the absence of internal damping and
external forcing, the sum of kinetic energy and potential energy is constant. Why is it that the
internal potential energy becomes negative as compared to its initial value? What is the initial
configuration of the system ((0), u(0)) in this example? About what values do (t) and u(t)
oscillate for t > 0? (spyrograph!)

CC BY-NC-ND HP Gavin

14

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

11 Constraints
Suppose that in a dynamical system described by m generalized dynamic coordinates,
q(t) =

q1 (t), q2 (t), , qm (t)

there are specific requirements on the motion that must be satisfied. For example, suppose the
elastic pendulum must move along a particular line, g((t), u(t)) = 0, or that the pendulum
can not move past a particular line, g((t), u(t)) 0. If these constraints to the motion of the
system can be written pureley in terms of the positions of the coordinates, then the system
(including the differential equations and the constraints) is called a holonomic system.
There are a number of intriguing terms connected to constrained dynamical systems.
A system with constraints that depend only on the position of the coordinates,
g(q(t), t) = 0
is holonomic.
A system with constraints that depend on the position and velocity of the coordinates,

g(q(t), q(t),
t) = 0

(in which g(q(t), q(t),


t) can not be integrated into a holonomic form) is non-holonomic.
A system with constraints that are independent of time,
g(q) = 0

or

=0
g(q, q)

is scleronomic.
A system with constraints that are explicitely dependent on time, as in the constraints
listed under the first two definitions is rheonomic.
A system with constraints that are linear in the velocities,

g(q(t), q(t))
= f (q(t)) q(t)
is pfafian.
Any unconstrained system must be forced to adhere to a prescribed constraint. The
required constraint forces QC are collocated with the generalized coordinates q, and the
virtual work of the constraint forces acting through virtual displacements is zero5
QC q = 0.
Geometrically, the constraint forces are normal to the displacement variations.
5

Lanczos, C., The Variational Principles of Mechanics, 4th ed., Dover 1986
CC BY-NC-ND HP Gavin

15

Generalized Coordinates and Lagranges Equations

11.1 Holonomic systems


Consider a constraint for the elastic pendulum in which the pendulum must move along
a curve g((t), u(t)) = 0. For example, consider the constraint
u(t) = l l2 (t)

g((t), u(t)) = 1 2 (t) u(t)/l .

Clearly the elastic pendulum will not follow the path g = 0 all by itself; it needs to be forced,
somehow, to follow the prescribed trajectory. 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, g(q) = 0. The guide exerts constraint forces
QC in a direction transverse to the guide, but not along the guide.
For relatively simple systems such as this, incorporating a constraint can be as simple
as solving the constraint equation for one of the variables, for example, u(t) = l l2 (t) and
using the constraint to eliminate one of the coordinates. With the substitution of u(t) =
l l2 (t) into the expressions for kinetic energy and potential energy, Lagranges equations
can be written in terms of the remaining coordinate, . This is a perfectly acceptable means
of incorporating holonomic constraints into an analysis. However, in general, 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. 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, and therefore misses an important aspect of the behavior
of the system. So a more general approach is required to derive the equations of motion for
constrained systems.
Recall that an admissible variation, q must adhere to all constraints. For example, the
solution to the constrained elastic pendulum, perterbued by [, u], must lie along the curve
1 2 u/l = 0. In order for the variation q to be admissible, the perturbed solution must
also lie on the line of the constraint. In other words, the variation q must be perpendicular
to the gradient of g with respect to q,
"

g
q

q = 0 .

(41)

A constraint evaluated at a perturbed solution q + q, in general, can be approximated via


a truncated Taylor series
"

g
g(q + q, t) = g(q, t) +
q + h.o.t. .
q
The constraints at the perturbed solution are satisfied for infinitessimal pertubations as long
as equation (41) holds. Because admissible variations q are normal to [g/q] and the
constraint force QC is normal to q, the constraint force must lie within [g/q],
"
C

Q =

g
q

CC BY-NC-ND HP Gavin

16

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

dg
dq

dg
.
dq

.
1
.
.
g(q , q , q , q ) = 0

g(q , q ) = 0
1

Figure 2. Admissibile variations q for holonomic (left) and non-holonomic (right) systems. In
holonomic systems q adheres to the constraint g(q) = 0 since q is normal to the gradient of

g with respect to q. In holonomic systems q need only be normal to g/ q.

The constraint forces QC


j may now be added into Lagranges equations as the forces
required to adhere the motion to the constraints gi (q) = 0.
d
dt

T
qj

X gi
V
T
+

i
Qj = 0
qj qj
qj
i

in which
X
i

(42)

gi
qj

is the generalized force on coordinate qj applied through the system of constraints,


g(q, t) = 0 .

(43)

These forces are precisely the actions that enforce the constraints. Equations (42) and (43)
uniquely describe the dynamics of the system. In numerical simulations these two systems of
equations are solved simultaneously for the accelerations, q
(t), and the Lagrange multipliers,
C
(t), from which the constraint forces, Q (t), can be found.

CC BY-NC-ND HP Gavin

17

Generalized Coordinates and Lagranges Equations

Lets apply this to the elastic pendulum, constrained to move along a path
u(t) = l l2 (t)

g((t), u(t)) = 1 2 (t) u(t)/l .

(44)

The derivitives of T and V are as they were previously. 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, +(2),
and the new term for the constraint force in the u direction in equation (36) is +(1/l). (This
problem has one constraint, and therefore one Lagrange multiplier, but two coordinates, and
therefore two generalized constraint forces.) There are no other non-conservative forces Qj
applied to this system. The problem now involves three equations (two equations of motion
and the constraint) and three unknowns , u (or their derivitives) and . In principle, a
solution can be found. In solving the equations of motion numerically, as a system of firstorder o.d.es, we solve for the highest order derivitives in each equation in terms of the
lower-order derivitives. In this case the highest order derivitives are and u. In the case of
constrained dynamics, we also need to solve for the Lagrange multiplier(s), . The constraint
equation(s) give(s) the additional equation(s) to do so. But in this problem the constraint
equation is in terms of positions and u. However, by differentiating the constraint we can
put this in terms of accelerations and u. So doing, with some rearrangement,
2l + u = 2l2 .

(47)

u, and .
Now we have three equations and three unknowns for ,
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 = 2l2

(48)
(49)
(50)

The constraint force in the direction is (2) and the constraint force in the u direction is
/l. The three equations may be written in matrix form . . .

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

22

(51)

Note that the initial condition of the system must also adhere to the constraints,
l02 + u0 = l
2l0 0 + u 0 = 0

(52)
(53)

These equations can be integrated numerically as was shown in the previous Matlab example, except for the fact that in the presence of constraints, the accelerations and Lagrange
multiplier need to be evaluated as a solution of three equations with three unknowns.
CC BY-NC-ND HP Gavin

18

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

(t) and u(t)

1
0.5
0
-0.5
-1

swing, q1(t) = (t), rad


stretch, q2(t) = u(t), m

-1.5
0

10

15

20

time, s

energies, Joules

K.E.
P.E.
K.E.+P.E.

4
3
2
1
0
0

10

15

20

time, s

Figure 3. Free response of an undamped elastic pendulum from an initial condition uo = l and

o = 1 constrained to move along the arc u = l l2 . The motion is periodic and the total
energy is conserved exactly.
0
t = 20.000 s

y position, m

-0.5

-1

-1.5

-2

(x0, y0)
-1

-0.5

0.5

x position, m

Figure 4. The constrained motion of the pendulum is seen to satisfy the equation u = l l2
for l = 1 m.
15

10

-5
constraint force, Q
u constraint force, Qu

-10
0

10

15

20

Figure 5. The constraint forces in the (blue) and u (green) directions required to enforce
the constraint u(t) = l l2 (t).

CC BY-NC-ND HP Gavin

19

Generalized Coordinates and Lagranges Equations

11.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) = 0 .
g(q, q,

(54)

The constraint forces QC


= 0. As always, any
j are normal to the constraint surface g(q, q,t)
admissible variations must satisfy the constraints
#

"

"

g
g
q +
q + h.o.t. = 0
g(q + q, q + q,
t) = g(q, q,
t) +
q
q
So, for infinitessimal variations,
"

g g
,
q q

"

q
q

=0.

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.


As in holonomic constraints, the constraint forces QC in non-holonomic systems do no
work through the displacement variations, q. Since admissible variations q are normal to
[g/ q],
the constraint forces must therefore lie within [g/ q],

"

QC = T

g(q, q)

Including these constraint forces into Lagranges equations gives the non-holonomic form of
Lagranges equations,78
d
dt

T
qj

X gi
T
V
+

i
Qj = 0 ,
qj qj
qj
i

in which
X
i

(56)

gi
qj

is the generalized force on coordinate qj applied through the system of constraints g = 0.


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.
6

P.S. Harvey, Jr., Rolling Isolation Systems: Modeling, Analysis, and Assessment, Ph.D. dissertation,
Duke Univ, 2013
7
M.R. Flannery, The enigma of nonholonomic constraints, Am. J. Physics 73(3) 265-272 (2005)
8
M.R. Flannery, dAlembert-Lagrange analytical dynamics for nonholonomic systems, J. Mathematical
Physics 52 032705 (2011)
CC BY-NC-ND HP Gavin

20

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

As an example, 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, = bu/l. The velocity transvese to the
steered angle must be zero, giving the constraint,
u
u)
= tan( + bu/l)

g(, u, ,
= 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)
q1

g
g
=
= cos( + bu/l)
(59)
q2
u
Equation (35) now includes a new term for the constraint force in the direction, (ls),
and the new term for the constraint force in the u direction in equation (36) is +(c), where
s = sin( + bu/l) and c = cos( + bu/l). Note that in this case, the constraint forces are
dependent upon the position of the pendulum ( and u), but not on the velocities. The
constraint equation along with the equations of motion uniquely define the solution (t),
u(t), and (t). Since, for numerical simulation purposes, we are interested in solving for the
and u(t), we can differentiate the constraint equation to transform it into
accelerations, (t)
a form that is linear in the accelerations,
u(s
g = bu 2 s/l + uc l2 c ls
+ bc)
(60)
Our three equations are now,
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 = l2 c + u(s
+ bc) + bu 2 s/l
with an initial condition that also satisfies the constraint, u 0 = l0 tan( + bu/l). The
equations may be written in matrix form . . .

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

l2 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). 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). Furthermore, if the differentiated
constraint equations (47) and (60) are written as
= A(q(t), q(t))
g

q
(t) b(q(t), q(t),

t)
then both equations (51) and (64) may be written
"

M AT
A 0

#"

"

Q
b

(65)

This expression can be obtained directly from Gausss principle of least constraint, which
provides an appealing interpretation of constrained dynamical systems.
CC BY-NC-ND HP Gavin

21

Generalized Coordinates and Lagranges Equations


1

(t) and u(t)

0.5
0
-0.5
swing, q1(t) = (t), rad
stretch, q2(t) = u(t), m

-1
0

10

15

20

25

30

35

40

energies, Joules

time, s
5
4
3
2
1
0
-1
-2

K.E.
P.E.
K.E.+P.E.
0

10

15

20

25

30

35

40

time, s

Figure 6. Free response of an undamped elastic pendulum from an initial condition uo = l/2,

u = tan( + bu/l), with b = 5.


o = 0.2 rad, o = 1 rad/s, with trajectory constrained by l/
The motion is not periodic but total energy is conserved exactly and the constraint is satisfied
at all times.
2
1.5

y position, m

1
0.5
0
t = 40.000 s
-0.5
-1
-1.5
-2
-1.5

(x0, y0)

-1

-0.5

0.5

1.5

x position, m

Figure 7. The constrained motion of the pendulum does not follow a fixed relation between u
and the constraint is non-holonomic. (ying & yang)
100

50

-50

-100

-150

-200
constraint force, Q
u constraint force, Qu

-250
0

10

15

20

25

30

35

40

Figure 8. The constraint forces in the (blue) and u (green) directions required to enforce
u = tan( + bu/l).
the constraint l/
CC BY-NC-ND HP Gavin

22

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

12 Gausss Principle of Least Constraint


Consider the equations of motion of the unconstrained system written as equation (38),
M(q, t) q
= Q(q, q,
t) .
The matrix M is assumed to be symmetric and positive definite. Define the accelerations of
the unconstrained system as
a M1 Q
and write the differentiated constraints as
A(q, q,
t) q
= b(q, q,
t).
The constrained system requires additional actions QC to enforce the constraint, so the
equations of motion of the constrained system are
M(q, t) q
= Q(q, q,
t) + QC (q, q,
t) .
Lastly, define a quadratic form of the accelerations,
1
G = (
q a)T M (
q a)
2
Gausss Principle of Least Constraint910 states that the accelerations of the constrained system q
minimize G subject to the constraints A
q = b. 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.
To minimize a quadratic objective subject to a linear constraint the objective can be
augmented via Lagrange multipliers ,
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
,
GA

!T

=0

M
q = Q AT

(67)

A
q=b

(68)

and maximized with respect to ,


GA

!T

=0

These conditions are met in equation (65), as derived earlier for both holonomic and nonholonomic systems,
"
#"
#
"
#
M AT
q

Q
=
.
A 0

b
9

Hofrath and Gauss, C.F., Uber ein Neues Allgemeines Grundgesatz der Mechanik,, J. Reine Angewandte Mathematik, 4:232-235. (1829)
10
Udwadia, F.E. and Kalaba, R.E., A New Perspective on Constrained Motion, Proc. Mathematical and
Physical Sciences, 439(1906):407-410. (1992).
CC BY-NC-ND HP Gavin

23

G( q"1(t), q"2(t) )

Generalized Coordinates and Lagranges 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 . While equation (65) is


sufficient for analyzing the behavior and simulating the response of constrained dynamical
systems, it is also useful in building an understanding of their nature. Solving the first of the
equations for q
,
q
= M1 Q M1 AT
and inserting this expression into the constraint equation,
AM1 Q AM1 AT = b
the Lagrange multipliers may be found,
= (AM1 AT )1 (b AM1 Q) ,
and substituting a = M1 Q, the constraint force, QC = AT , can be found as well,
QC = AT (AM1 AT )1 (Aa b) .
or
QC = K(Aa b) .
The difference (Aa b) is the amount of the constraint violation associated with the unconstrained accelerations a. If the unconstrained accelerations satisfy the constraint, then the
constraint force is zero. The matrix K = AT (AM1 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, QC .
The constrained minimum of the quadratic objective G gives the correct equations of motion.
CC BY-NC-ND HP Gavin

Вам также может понравиться