Lagrangian Dynamics
Lagrangian Dynamics
Dr Peter Brommer
Methods for dynamical systems
Newton's second law: F = ma
FBD and vector force analysis, algebraic difficulties for higher DoF.
d
Energy method: dt
( )
T +U = 0 for conservative system
One equation only for single DoF.
Virtual work
A powerful tool for higher DoF, but still vector considerations for forces
Lagrange’s equation
A scalar procedure for higher DoF.
PB3: 2
Virtual Work
Formulated by Johann J. Bernoulli:
If a system in equilibrium under the action of a set of forces is given a virtual
displacement, the virtual work done by the forces will be zero
dW = å F • δr = 0
i
i i
F2
δr
Fi
A virtual displacement δ is an imaginary infinitesimal variation of the coordinate; Virtual
work is the work done by all the active forces in a virtual displacement. Because there is no
significant change of geometry associated with the virtual displacement, the forces acting
on the system are assumed to remain unchanged for the calculation. Virtual displacements
are instantaneous.
Example: Using the virtual work method, determine the equations of motion for the above system
The independent coordinates for the problem are x and θ.
First giving x a virtual displacement δx, the virtual work equation is
! ℓ "" $ ! ℓ "2 $
!
( !! ) #
()
δW = − " m1 + m2 x + kx $δ x − # m2 θ cosθ & δ x + # m2 θ sinθ & δ x + F t δ x = 0
" 2 % " 2 %
PB3: 6
Applying Virtual Work
The preceding equation leads to:
ℓ
( m1 + m2 x!! + m2 θ""cosθ − θ! 2 sinθ + kx = F t
) ( ) ()
2
Next, allow a virtual displacement δθ, δW is then
! ℓ ""$ ℓ ! ℓ2 ""$
δW = − # m2 θ & δθ − # m2 θ & δθ
" 2 %2 " 12 %
ℓ ℓ
(
− m2g sinθ ) δθ − m2 x!! cosθ δθ + F t cosθ ℓδθ = 0
( ) ( () )
2 2
ℓ2 "" ℓ ℓ
m2 θ + m2 x"" cosθ + m2g sinθ = F t ℓcosθ ()
3 2 2
Thomson 7.2.2
PB3: 7
Applying Virtual Work
These are nonlinear differential equations, which for small angles simplify
to
!! ℓ ""
( )
m1 + m2 x + m2 θ + kx = F(t)
2
ℓ2 "" ℓ ℓ
m2 θ + m2 x"" + m2g θ = ℓF t ()
3 2 2
Which can be expressed by the matrix equation
! ℓ $
# m1 + m2 m2 &! ! k 0 $ ! $
# 2 $
&# x"" & + # &! x $ # F t
&=#
() &
# ℓ ℓ2 &" θ!! % # 0 m g ℓ &# &
# m2 m2 & #" 2
2 ()
&%" θ % #" ℓF t &%
" 2 3 %
PB3: 8
Do you see the point of the
Virtual Work method?
A. Not yet…
B. No, Newton is
easier.
C. Yes, much better.
D. I don’t care.
PB3: 9
Lagrangian Dynamics
Newton's second law: F = ma
FBD and vector force analysis, algebraic difficulties for higher DoF.
d
Energy method: dt
( )
T +U = 0 for conservative system
One equation only for single DoF.
Virtual work
A powerful tool for higher DoF, but still vector considerations for forces
Lagrange’s equation
A scalar procedure for higher DoF.
PB3: 10
Generalized Co-ordinates
Generalized coordinates are any set of independent coordinates equal in
number to the degrees of freedom of the system.
Thomson 7.1
Tongue 1.5
PB3: 11
Generalized Co-ordinates
Practical Points
Concept of Generalized Co-ordinates is important to the
development of methods such as Lagrange
– and for easy-to-solve models of complex systems.
Most commonly, the set of qi is some mix of length and
angular variables.
– E.g., they could be polar co-ordinates.
Despite qi not necessarily being displacements, their time
derivatives are called Generalized Velocities.
For each Cartesian spatial variable, we have
n " ∂x %
j
δ x j = ∑$$ δqi ''
i=1 # ∂qi &
Thomson 7.1
Tongue 1.5
PB3: 12
Generalized Co-ordinates
Practical Points
z
y
ψ Φ
x
m
As a simple example, the position of the spherical pendulum can be completely defined
by the two independent coordinates ψ and Φ. Hence, ψ and Φ are generalized
coordinates, and the spherical pendulum represents a system of two degrees of
freedom.
The position of the spherical pendulum can also be described by the three Cartesian
coordinates (x, y, z), which exceed the degrees of freedom by 1. Coordinates x,y,z are,
however, not independent: they are related by the constraint equation: x2+y2+z2 = l2
PB3: 13
Lagrangian Dynamics
J L Lagrange introduced a new mathematical
approach to Newton’s 2nd law in the late C18.
– In modern words, it’s a work-energy method
– Very powerful for more complex systems
The bad news: its basis is mathematically abstract.
The good news: you don’t have to derive it!
The moderate news:
– Risky to use a method without understanding it
– So, read the derivation in textbooks (Thomson, Goldstein)
– Lectures will outline the main arguments and implications and explain some
jargon.
Thomson 7.3
Tongue 1.5
PB3: 14
Lagrange’s Equation
d ! ∂T $ ∂T ∂V d ! ∂L $ ∂L
## && − + = Qi or ## && − = Qi
dt " ∂q! i % ∂qi ∂qi dt " ∂q! i % ∂qi
Thomson 7.3
Tongue 1.5
PB3: 15
‘Particle’ re-visited
Most derivations of Lagrange’s equation start with a
particle. Many texts are a bit vague about switching to
rigid body models.
Rigid
body
+
F = ma M = Ia
PB3: 16
Generalized Forces
Conservative Forces
A potential field in (x, y, z) must also, by definition, be
a function of the qi alone. So we gain the idea of a
Conservative Generalized Force:
Qi = − ∂V
∂qi
PB3: 19
Getting to Lagrange 1
A very simple example shows the form of the derivation.
Particle in (x, y) Cartesian frame and with generalized co-ordinates
(q1, q2) – e.g. they might be polars.
Noting that work (energy) is scalar (easy to add terms!) we attempt
a virtual work method.
Apply a virtual displacement to the real and inertia forces in
Newton’s law:
!! • δr = 0
(F − mx)
"" ∂x ∂y % " ∂x ∂y % %
∑$$$$Fx ∂q + Fy ∂q ''δqi − $$ mx!! + my!! '' δqi '' = 0
i ## i i & # ∂qi ∂qi & &
Thomson 7.3
PB3: 20
Getting to Lagrange 2
The abstract step! Right-hand terms remind us a bit of
some other notational tricks – they look a bit like parts of
formulae for derivatives of products. Try:
d "$ ! ∂x i %' !! ∂x i ! ∂x! i Inertial Frame!!!
$ xi ' = xi + xi
dt # ∂q j & ∂q j ∂q j
Displacements and velocities have same relationships, so:
" % " 2% 2
∂x i d ∂x! i ∂x! i d ∂ x! i ' ∂ x! i
x!!i = $$ x! i ' − x! i
' = $ −
∂q j dt # ∂q! j & ∂q j dt $# ∂q! j 2 '& ∂q j 2
PB3: 21
Ge#ng to Lagrange 3
Substitute this form back into the earlier equation, note the
virtual displacement is arbitrary and re-arrange:
d ! ∂T $ ∂T
## && − = Qi Inertial Frame!!!
dt " ∂q! i % ∂qi
Some Qi might be conservative, so separate them out,
leaving the remaining Qi or (Qext) as solely external forces
d ! ∂T $ ∂T ∂V d ! ∂L $ ∂L
## && − + = Qi or ## && − = Qi
dt " ∂q! i % ∂qi ∂qi dt " ∂q! i % ∂qi
PB3: 22
Getting to Lagrange 4
Lagrange’s Equation generates a separate equation
for each i = 1 … n.
We need to evaluate only the kinetic and potential
energy T and V, and any non-conservative external
forces.
Danger: the kinetic energy was derived from an
acceleration – we must use absolute velocity to
calculate it.
Works for any generalised coordinate, not just
distances.
So, just run through all the derivative terms and
add them up to get complete equations of motion.
PB3: 23
Benefits of the Lagrangian Method
It is a scalar method, so reducing the risk of summation errors
in more complex systems.
The equations of motion are derived in the same way for any
set of co-ordinates (a routine process).
Kinetic energy involves only velocity – accelerations need not
be calculated, simplifying the kinematics.
– Velocities are squared, so no problems over signs.
No need to use multiple free-body diagrams.
It automatically generates the required number of equations
of motion.
Explore from now on by using it.
PB3: 24
Elementary Illustra.on
Not a sensible use of m
k x
Lagrange, but it shows
the basic steps. T = 21 mx! 2 V = 21 kx 2
x is the only co-ord. ∂T ∂V
and is inertial – use it =0 = kx
∂x ∂x
as the Gen. Coord. d " ∂T % d
Free vibration, no $ '= mx! = mx!!
( )
dt # ∂x! & dt
external force.
mx!! + kx = 0
PB3: 25
Orbit about a massive body
Lagrange is general, not just for vibration!
No external force, energy terms are
y m
T = 21 m( x! + y! ) V = − GMm
2 2
r
r
3 parameters – not independent.
x
Use polars as generalized co-ords. M
PB3: 26
Orbit 2
Now evaluate all the Lagrange terms:
d ! ∂T $ !! ∂T ! 2 ∂V GMm
# & = mr = mr θ =
dt " ∂r! % ∂r ∂r r2
d ! ∂T $ 2 !!
! ! ∂T ∂V
# !& = mr θ + 2mrr θ = 0 =0
dt " ∂θ % ∂θ ∂θ
Centripetal term
Lagrange’s equation for r gives
mr!! − mr θ! 2 = − GMm 2
Conservation of
r Angular Momentum
Lagrange’s equation for q gives
d
mr 2θ! = 0
dt
PB3: 27
Lagrange & Rigid Bodies
A Reminder
Lagrange’s Equation applies equally to M = Ia as to
F = ma and so to Euler’s rigid body equations.
Free motion must reference to the Centre of Mass when
evaluating KE and generalized forces.
E.g., motion on horizontal plane.
3 independent co-ordinates.
F
T = 21 m( x! 2 + y! 2 ) + 21 IGθ! 2 V =0
s
Qx = Fx Qy = Fy Qθ = Fs
Then calculate derivative terms, etc.
PB3: 28
Lagrange How-to
Write down kinetic and potential energy (T, V).
If necessary, use constraints to eliminate non-
independent variables (n DoF = n variables)
Write down partial derivatives with respect to
generalised coordinates, velocities:
d ! ∂T $ ∂T ∂V
## && , − ,
dt " ∂q! i % ∂qi ∂qi
Write down equations of motion by plugging
derivatives in Lagrange’s equation.
Solve equations of motion.
PB3: 29
Lagrange needs practice!
We now look at a few more complicated
examples.
Systems are still very artificial, but contain
ideas that occur often in practice.
Too much detail to see easily on slides, so
consult the support documents to back up
general discussion of them in lectures.
Lectures will work through them but the few
slides here are just reminders of key points.
PB3: 30
Pendulum + Horizontal Trolley
Assume:
No friction.
Pendulum rod is light (massless).
Pendulum rod is inextensible.
Linear spring.
Trolley is a particle (moves in
straight line).
Pendulum bob is small – particle.
PB3: 31
Energy terms
! !
Trolley KE v1 = x!i T1 = 21 Mx! 2
! ! !
Pendulum KE v 2 = ( x! + lϕ! cos ϕ )i + lϕ! sinϕ j
T2 = 21 m x! 2 + l 2ϕ! 2 + 2 x! lϕ! cos ϕ
( )
Total KE
1 !2 1
T = Mx + 2 m x! 2 + l 2ϕ! 2 + 2 x! lϕ! cos ϕ
( )
2
Spring + gravity PE
V = 21 kx 2 + mgl(1− cos ϕ )
PB3: 32
Lagrange solution
Qext = 0 – free vibration.
dt " ∂x! %
∂T
=0
∂x
∂V
= kx
∂x
PB3: 33
Lagrange solution
For f:
¶T
= mx!l cos φ + ml 2φ!
¶φ!
d æ ¶T ö
çç ÷÷ = ml!x!cos φ - mx!lφ! sin φ + ml 2φ
!!
dt è ¶φ! ø
¶T
= -mlx!φ! sin φ
¶φ
¶V
= mgl sin φ
¶φ
PB3: 34
Now build Lagrange’s equations in x and in f.
d ! ∂T $ ∂T ∂V d ! ∂T $ ∂T ∂V
# &− + =0 # &− + =0
dt " ∂x! % ∂x ∂x dt " ∂ϕ! % ∂ϕ ∂ϕ
(M + m) x!! + mlϕ!! cos ϕ − mlϕ! 2 sinϕ + kx = 0 (1)
ml 2ϕ!! + mlx!! cos ϕ + mgl sinϕ = 0 (2)
PB3: 35
Equation of Motion
If Qext = F.
! M + m ml $' x!! * ! k 0 $' x * ' F *
# &)) ,+#
,
&)
)
, = ))
, ,,
" m ml %( ϕ!! + #" 0 mg &%( ϕ + ( 0 +
PB3: 36
Damping in Lagrange’s Equation
The energy dissipation by a viscous force is modelled in terms of
the generalized velocity across the damper by
D = 21 cq! 2
Lagrange is then expressed as
d " ∂T % ∂T ∂V ∂D
$$ '' − + + = Qext
dt # ∂q! i & ∂qi ∂qi ∂q! i
This is a “band aid” extension to the Lagrange formalism.
PB3: 37
1 DoF Damped Vibration
Really, too simple to use a Lagrange, but …
F(t)
1 DoF, so 1 Gen. Co-ord. m x
Force is along x, so it is also k
the generalized force. c
T = 21 mx! 2 V = 21 kx 2 D = 21 cx! 2
d ! ∂T $ !! ∂T ∂V ∂D
# & = mx =0 = kx = cx!
dt " ∂x! % ∂x ∂x ∂x!
mx!! + cx! + kx = F(t)
PB3: 38
Disc, springs and gravity
Assume:
No slip of the string over the disc;
Springs are linear;
No friction in the springs or bearing;
Mass is a particle;
Motion constrained along x direction.
Disc is a fixed-axis rotation.
Suitable generalized coordinates: x, f.
PB3: 39
Could you follow the worked example?
( responseware.eu – multiple answers)
A. Yes – everything
clear
B. No – n dof?
C. No – set up T, V, L?
D. No – calc.
derivatives?
E. No – assemble
e.o.m?
PB3: 40
Solving the system
Need to show that gravity terms drop out here.
• See example.
Kinematic constraints link rotation to the extensions.
Then the Lagrangian is
2 2
L = T −V = 2 Iϕ + 2 mx! − 2 k1 (r ϕ ) − 2 k 2 ( x − r ϕ )
1 !2 1 2 1 1
PB3: 41
PB3: 42
Could you follow the worked example?
(responseware.eu – multiple answers)
A. Yes – everything clear
B. No – n dof?
C. No – set up T, V, L?
D. No – calc.
derivatives?
E. No – assemble e.o.m?
F. No – calculate ω?