Home › Analytical mechanics › Lagrange's equations
Lagrange's equations
Derivation of Lagrange's equations of the second kind, kinetic energy in generalized coordinates, the Lagrangian, non-conservative forces and the equations of the trolley with a load.
trolley mass M = 200 kg; load mass m = 1000 kg; rope length l = 4 m;
the trolley runs along a horizontal girder without friction; the rope is inextensible and massless.
1. Derivation
From the general equation of dynamics, by expressing velocities and accelerations through the generalized coordinates and using the identity ∂ṙi/∂q̇j = ∂ri/∂qj, the inertia term is expressed through the kinetic energy Ek. Since the δqj are independent, one equation is obtained for each coordinate, Lagrange's equations of the second kind:
$$\frac{d}{dt}\frac{\partial E_k}{\partial\dot q_j} - \frac{\partial E_k}{\partial q_j} = Q_j, \qquad j = 1, \dots, n$$2. The Lagrangian
If all active forces are conservative, Qj = −∂Ep/∂qj. Introducing the Lagrangian L = Ek − Ep, the equations take the form
$$\frac{d}{dt}\frac{\partial L}{\partial\dot q_j} - \frac{\partial L}{\partial q_j} = 0$$Non-conservative forces (friction, driving forces) are added as generalized forces on the right-hand side. The whole dynamics of the system is contained in a single scalar function.
3. Procedure
- Determine the number of degrees of freedom and choose the generalized coordinates.
- Express the velocities of all bodies through q and q̇ and write Ek and Ep.
- Find the generalized forces of the non-conservative forces from their virtual work.
- Carry out the differentiations. The result is a set of second-order differential equations.
4. Example: trolley with a load
The velocity of the load has the components ẋ + l θ̇ cos θ and l θ̇ sin θ, so
$$E_k = \tfrac12 (M + m)\,\dot x^2 + m\, l\,\dot x\,\dot\theta\cos\theta + \tfrac12\, m\, l^2\dot\theta^2, \qquad E_p = -\,m\, g\, l\cos\theta$$Lagrange's equations for x and θ, with a horizontal force P on the trolley:
$$(M + m)\,\ddot x + m\, l\,(\ddot\theta\cos\theta - \dot\theta^2\sin\theta) = P$$ $$\ddot x\cos\theta + l\,\ddot\theta + g\sin\theta = 0$$ẍ = P/M = 2000/200 = 10 m/s², not 2000/1200 = 1.67 m/s²;
θ̈ = −ẍ/l = −2.5 rad/s²: the rope immediately tilts backwards.
At the first instant the load "takes no part" in the horizontal acceleration, because the rope is vertical and transmits no horizontal force.
5. What the equations show
The equations are coupled: the motion of the trolley excites the swinging of the load, and the swinging of the load pushes the trolley. That is why crane operators accelerate and brake gradually, and modern cranes have controls that damp the sway automatically. The term m l θ̇² sin θ is the centrifugal force of the load. The girder reaction and the rope force do not appear at all, although Newton's approach would need them.
Practice problems
Problem 1. ●○○ easy What is the kinetic energy of the trolley-load system at ẋ = 1 m/s, θ = 0 and θ̇ = 0.25 rad/s?
What is happening: The load's kinetic energy is not the sum of trolley motion and swing energies: there is a cross term, since both velocities add as vectors.
Show answer and solution
Solution idea: Substitute into the Ek formula.
Given: \(M = 200\), \(m = 1000\ \text{kg}\), \(l = 4\ \text{m}\), \(\dot x = 1\ \text{m/s}\), \(\dot\theta = 0.25\ \text{rad/s}\), \(\theta = 0\)
Find: \(E_k = ?\)
Symbols:
- \(M\) – trolley mass, kg
- \(m\) – load mass, kg
- \(l\) – rope length, m
- \(\dot x\) – trolley speed, m/s
- \(x\) – trolley position (generalized coordinate), m
- \(\dot\theta\) – rope angular velocity, rad/s
- \(\theta\) – rope angle from vertical (generalized coordinate), °, rad
- \(E_k\) – kinetic energy of the system, J
- \(E_x\) – energy of the common motion with the trolley, J
- \(E_{x\theta}\) – cross term (coupling of trolley and swing), J
- \(E_\theta\) – kinetic energy of the load swing, J
- Kinetic energy in generalized coordinates (from the chapter):$$E_k = E_x + E_{x\theta} + E_\theta$$$$E_x = \tfrac{1}{2}(M + m)\dot x^2$$$$E_{x\theta} = m l\,\dot x\dot\theta\cos\theta$$$$E_\theta = \tfrac{1}{2} m l^2\dot\theta^2$$
- Numbers:$$\begin{aligned}E_k &= 600 + 1000 + 500 \\ &= 2100\ \text{J}\end{aligned}$$
Answer: Ek = 2100 J
Sanity check: The cross term (1000 J) is almost half the total. At θ = 0 both load velocities are horizontal: 1 + 4·0.25 = 2 m/s, so the load alone has ½·1000·4 = 2000 J and the trolley 100 J ✓.
Problem 2. ●●○ medium The free trolley (P = 0) and load are released from rest at θ = 10°. What are the initial trolley acceleration and the rope's angular acceleration?
What is happening: With no external horizontal force, the load swinging back toward vertical pulls the light trolley toward itself. The equations are coupled: one coordinate drives the other.
Show answer and solution
Solution idea: Two equations, two unknowns.
Given: \(M = 200\), \(m = 1000\ \text{kg}\), \(l = 4\ \text{m}\), \(\theta = 10^\circ\), \(\dot\theta = 0\), \(P = 0\)
Find: \(\ddot x,\ \ddot\theta = ?\)
Symbols:
- \(M\) – trolley mass, kg
- \(m\) – load mass, kg
- \(l\) – rope length, m
- \(\theta\) – rope angle from vertical (generalized coordinate), °, rad
- \(\dot\theta\) – rope angular velocity, rad/s
- \(P\) – pulling force on the trolley, N
- \(\ddot x\) – trolley acceleration, m/s²
- \(x\) – trolley position (generalized coordinate), m
- \(\ddot\theta\) – rope angular acceleration, rad/s²
- \(g\) – gravitational acceleration, 9.81 m/s²
- Lagrange equations with θ̇ = 0:$$(M + m)\ddot x + m l\ddot\theta\cos\theta = 0$$$$l\ddot\theta + \ddot x\cos\theta + g\sin\theta = 0$$
- Eliminating θ̈:$$\begin{aligned}\ddot x &= \frac{m g\sin\theta\cos\theta}{M + m\sin^2\theta} \\ &= \frac{1678}{230} \\ &= 7.29\ \text{m/s}^2\end{aligned}$$$$\begin{aligned}\ddot\theta &= -\frac{\ddot x\cos\theta + g\sin\theta}{l} \\ &= -2.22\ \text{rad/s}^2\end{aligned}$$
Answer: ẍ = 7.29 m/s² (toward the load); θ̈ = −2.22 rad/s²
Sanity check: The trolley accelerates as much as 7.3 m/s², being 5 times lighter than the load. With a braked trolley θ̈ would be −g sin θ/l = −0.43 rad/s²; the free trolley makes it 5 times larger.
Problem 3. ●○○ easy A pulling force P = 2 kN acts on the trolley and wind F = 500 N (horizontal) on the load. What are the generalized forces Qx and Qθ at θ = 10°?
What is happening: A generalized force is the coefficient of a coordinate's virtual displacement in the work expression. Its unit depends on the coordinate: force for a length, moment for an angle.
Show answer and solution
Solution idea: δW in terms of δx and δθ, then coefficients.
Given: \(P = 2000\ \text{N}\), \(F = 500\ \text{N}\), \(l = 4\ \text{m}\), \(\theta = 10^\circ\)
Find: \(Q_x,\ Q_\theta = ?\)
Symbols:
- \(P\) – pulling force on the trolley, N
- \(F\) – wind force on the load, N
- \(l\) – rope length, m
- \(\theta\) – rope angle from vertical (generalized coordinate), °, rad
- \(Q_x\) – generalized force for x, N
- \(Q_\theta\) – generalized force for θ, N·m
- \(\delta W\) – virtual work, J
- \(\delta x\) – virtual trolley displacement, m
- \(x\) – trolley position (generalized coordinate), m
- \(\delta\theta\) – virtual change of angle, rad
- Virtual work of the non-conservative forces (x2 = x + l sin θ):$$\begin{aligned}\delta W &= P\,\delta x + F\,(\delta x + l\cos\theta\,\delta\theta) \\ &= Q_x\,\delta x + Q_\theta\,\delta\theta\end{aligned}$$
- Generalized forces:$$\begin{aligned}Q_x &= P + F \\ &= 2500\ \text{N}\end{aligned}$$$$\begin{aligned}Q_\theta &= F\, l\cos\theta \\ &= 500\cdot 4\cdot 0.985 \\ &= 1970\ \text{N·m}\end{aligned}$$
Answer: Qx = 2500 N; Qθ = 1970 N·m
Sanity check: Wind on the load also acts on the trolley (in Qx), although not directly – the rope transmits it. Weight is not in Q, as it is already in the potential energy.