### Lagrange`s Equation

```Dynamic Simulation:
Lagrangian Multipliers
Objective

The objective of this module is to introduce Lagrangian multipliers
that are used with Lagrange’s equation to find the equations that
control the motion of mechanical systems having constraints.

The matrix form of the equations used by computer programs such as
Autodesk Inventor’s Dynamic Simulation are also presented.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Basic Problem in Multi-body Dynamics
Module 7 – Lagrangian Multipliers
Page 2
In the previous module (Module 6)
we developed Lagrange’s equation
and showed how it could be used to
determine the equations of simple
motion systems.
Lagrange’s Equation
d  L  L

 
0
dt  qi  qi
The examples we considered were for systems in which there
were no constraints between the generalized coordinates.
The basic problem of multi-body dynamics is to systematically find
and solve the equations of motion when there are constraints that
bodies in the system must satisfy.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Non-conservative Forces
Module 7 – Lagrangian Multipliers
Page 3





The derivation of Lagrange’s equation in the previous module (Module
6) considered only processes that store and release potential energy.
These processes are called conservative because they conserve energy.
Lagrange’s equation must be modified to accommodate nonconservative processes that dissipate energy (i.e. friction, damping, and
external forces).
A non-conservative force or moment acting on generalized coordinate
qi is denoted as Qi.
The more general form of Lagrange’s equation is
d  L  L

 
 Qi
dt  qi  qi
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Simple Pendulum
Module 7 – Lagrangian Multipliers
Page 4
 The pendulum shown in the
figure will be used as an
example throughout this
module.
Simple
Pendulum
Y
 The position of the pendulum
is known at any instance of
time if the coordinates of the
c.g., Xcg,Ycg, and the angle q
are known.
y
Ycg
x
θ
c.g.
X
 Xcg,Ycg and q are the
generalized coordinates.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
Xcg
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Kinetic and Potential Energies
Page 5
The kinetic energy (T) and potential
energy (V) of the pendulum are
1 2 1  2 1
2
T  Iq  mX cg  mYcg
2
2
2
V  mgYcg
These equations also give the
kinetic and potential energy of the
unconstrained body flying through
the air.
There needs to be a way to include
the constraints to differentiate
between the two systems.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
Y
y
Ycg
x
θ
c.g.
X
Xcg
Unconstrained
Body
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Constraint Equations
Module 7 – Lagrangian Multipliers
Page 6
 In addition to satisfying
Lagrange’s equations of motion,
the pendulum must satisfy the
constraints that the
displacements at X1 and Y1 are
zero.
y
Ycg
 The constraint equations are

X cg  sin q  X 1  0
2

Ycg  cos q  Y1  0
2
X1,Y1
Y
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
x
θ
c.g.
X
Xcg
The c.g. lies on the yaxis halfway along the
length  .
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Lagrangian Multipliers
Module 7 – Lagrangian Multipliers
Page 7
 The kinetic energy is augmented by
adding the constraint equations
multiplied by parameters called
Lagrangian Multipliers.
Y1
X1
Y
 Note that since the constraint
equations are equal to zero, we have
not changed the magnitude of the
kinetic energy.
 The Lagrangian multipliers are
treated like unknown generalized
coordinates.
What are the units of l1 and l2?
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
θ
X
1 2 1  2 1  2
Iq  mX cg  mYcg
2
2
2



 l1  X cg  sin q  X 1 
2





 l2  Ycg  cos q  y1 
2


T
www.autodesk.com/edcommunity
Education Community
Governing Equations
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 8
 In the following slides, Lagrange’s
equation will be used in a systematic
manner to determine the equations of
motion for the pendulum.
 The governing equations that will be
used are shown here.
 There are no non-conservative forces
acting on the system ( Qi  0 ).
Lagrange’s Equation
d  L

dt  qi
 L
 
 Qi
 q i
Lagrangian
n
L   Ti  Vi
i 1
1 2 1  2 1  2






L  Iq  mX cg  mYcg  l1  X cg  sin q  X 1   l2  Ycg  cos q  Y1   mgYcg
2
2
2
2
2




Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for
1st
Section 4 – Dynamic Simulation
Generalized Coordinate
Module 7 – Lagrangian Multipliers
Page 9
1 2 1  2 1  2






L  Iq  mX cg  mYcg  l1  X cg  sin q  X 1   l2  Ycg  cosq  Y1   m gYcg
2
2
2
2
2




Lagrange’s Equation
d  L

dt  qi
 L
 
 Qi
 q i
Mathematical Steps
L
 mX cg
q1
Generalized Coordinates
q1  X cg
q2  Ycg
q3  q
q4  l1
d  L 

  mXcg
dt  q1 
L
 l1
q1
1st Equation
mXcg  l1  0
q5  l2
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for 2nd Generalized Coordinate
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 10
1 2 1  2 1  2






L  Iq  mX cg  mYcg  l1  X cg  sin q  X 1   l2  Ycg  cosq  Y1   m gYcg
2
2
2
2
2




Lagrange’s Equation
d  L

dt  qi
 L
 
 Qi
 q i
Mathematical Steps
L
 mYcg
q 2
d  L 

  mYcg
dt  q 2 
Generalized Coordinates
L
 l2  mg
q2
q1  X cg
q2  Ycg
q3  q
q4  l1
2nd Equation
mYcg  l2  mg  0
q5  l2
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Equation for 3rd Generalized Coordinate
Module 7 – Lagrangian Multipliers
Page 11
1 2 1  2 1  2






L  Iq  mX cg  mYcg  l1  X cg  sin q  X 1   l2  Ycg  cosq  Y1   m gYcg
2
2
2
2
2




Lagrange’s Equation
d  L

dt  qi
 L
 
 Qi
 q i
Generalized Coordinates
q1  X cg
q2  Ycg
q3  q
q4  l1
q5  l2
Mathematical Steps
L
 Iq
q3
d  L 

  Iq
dt  q3 
L


 l1 cos q  l2 sin q
q3
2
2
3rd Equation




Iq  l1 cos q  l2 sin q  0
2
2
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Equation for 4th Generalized Coordinate
Module 7 – Lagrangian Multipliers
Page 12
1 2 1  2 1  2






L  Iq  mX cg  mYcg  l1  X cg  sin q  X 1   l2  Ycg  cosq  Y1   m gYcg
2
2
2
2
2




Lagrange’s Equation
d  L

dt  qi
 L
 
 Qi
 q i
Generalized Coordinates
q1  X cg
q2  Ycg
q3  q
q4  l1
q5  l2
Mathematical Steps
L
0
q 4
d  L 

  0
dt  q 4 
L

 X cg  sin q  X 1
q4
2
4th Equation

X cg  sin q  X 1  0
2
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Equation for 5th Generalized Coordinate
Module 7 – Lagrangian Multipliers
Page 13
1 2 1  2 1  2






L  Iq  mX cg  mYcg  l1  X cg  sin q  X 1   l2  Ycg  cosq  Y1   m gYcg
2
2
2
2
2




Lagrange’s Equation
d  L

dt  qi
 L
 
 Qi
 q i
Generalized Coordinates
q1  X cg
q2  Ycg
Mathematical Steps
L
0
q5
d  L 

  0
dt  q5 
L

 Ycg  cos q  Y1
q5
2
5th Equation
q3  q
q4  l1
q5  l2

Ycg  cos q  Y1  0
2
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Summary of Equations
Module 7 – Lagrangian Multipliers
Page 14
 There are five unknown generalized
coordinates including the two
Lagrangian Multipliers. There are
also five equations.
 Three of the equations are
differential equations.
 Two of the equations are algebraic
equations.
 Combined, they are a system of
differential-algebraic equations
(DAE).
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
  l  0
mX
cg
1
mYcg  l2  mg  0




Iq  l1 cos q  l2 sin q  0
2
2

X cg  sin q  X 1  0
2

Ycg  cos q  Y1  0
2
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Free Body Diagram Approach
Module 7 – Lagrangian Multipliers
Page 15
Summation of Forces in the X-direction
  l  0
mX
cg
1
λ2
Summation of Forces in the Y-direction
λ1
mYcg  l2  mg  0
Summation of Moments about the c.g.

cos q
2




Iq  l1 cos q  l2 sin q  0
2
2
The application of Lagrange’s
equation yields the same
equations obtained by drawing a
free-body diagram.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
q

mYcg
2

sin q
2
mXcg
Iθcg
mg
Free Body Diagram with
Inertial Forces
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Physical Significance of Lagrangian Multipliers
Module 7 – Lagrangian Multipliers
Page 16
Newton’s 2nd Law in x-direction
mXcg  l1  0
Force required to impose
the constraint that X1 is a
constant.
Lagrangian Multipliers are simply the forces (moments) required to
enforce the constraints. In general, the Lagrangian Multipliers are a
function of time, because the forces (moments) required to enforce
the constraints vary with time (i.e. depend on the position of the
pendulum).
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Matrix Format
Module 7 – Lagrangian Multipliers
Page 17
 The computer implementation of Lagrange’s equation is
facilitated by writing the equations in matrix format.
 Separating the Lagrangian into kinetic and potential
energy terms enables Lagrange’s equation to be written as
d  T  T
V

 
 Qi 
dt  qi  qi
qi
 In this format, the conservative and non-conservative
forces are lumped together on the right hand side of the
equation.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Matrix Format
Module 7 – Lagrangian Multipliers
Page 18
The kinetic energy augmented with Lagrangian Multipliers can be
written in matrix format as
1 T
T








T  q M  q  l  q, t 
2
q
Column array containing generalized coordinate
velocities.
q, t  Column array containing the constraint equations
(refer to Module 3 in this section).
l
M 
Column array containing the Lagrangian multipliers.
Inertia Matrix
m A

M    0
0

 0
0
mA
0
0
0
I cgA
0
0
0

0
0


Matrix containing the mass and mass moments of
inertia associated with each generalized coordinate.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Matrix Format
Module 7 – Lagrangian Multipliers
Page 19
Lagrange’s equation for a mechanical system becomes
  i 
M q l    Q
 q j 
T
  i 

 Is the constraint equation Jacobian matrix introduced in Module 4
 q j  in this section.
Q
Column array containing both conservative and non-conservative
forces.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Matrix Format
Module 7 – Lagrangian Multipliers
Page 20

Another equation for acceleration
was obtained in Module 4 based
on kinematics and the constraint
equations.
  i 

q   
 q j 

Combining this equation with
Lagrange’s equation from the
previous slide yields:
Matrix Form of Equations

M

  i
 q j

 i 

q j   q Q 
    
0  l    


 This equation can be solved
to find the accelerations
and constraint forces at an
instant in time.
 The accelerations must
then be integrated to find
the velocities and positions.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Solution of Differential-Algebraic
Equations (DAE)
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 21
 The solution of even the simplest system of DAE requires
computer programs that employ predictor-corrector type
numerical integrators.
 The Adams-Moulton method is an example of the type of
numerical method used.
 Significant research has led to the development of efficient and
robust integrators that are found in commercial computer
programs that generate, assemble, and solve these equations.
 Autodesk Inventor’s Dynamic Simulation environment is an
example of such software.
Freely licensed for use by educational institutions. Reuse and changes require a note indicating
that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Section 4 – Dynamic Simulation
Module Summary
Module 7 – Lagrangian Multipliers
Page 22

This module showed how Lagrangian Multipliers are used in
conjunction with Lagrange’s equation to obtain the equations that
control the motion of mechanical systems.

The method presented provides a systematic method that forms the
basis of mechanical simulation programs such as Autodesk Inventor’s
Dynamic Simulation environment.

The matrix format of the equations were presented to provide insight
into the computations performed by computer software.

The Jacobian and constraint kinematics developed in Module 4 of this
section are an important part of the matrix formulation.