We’ve seen the Lagrangian formulation of mechanics, and we have seen how to use it to derive the equations of motion for a system. We will cover a few common examples of Lagrangian mechanics and point out some of the subtleties that arise in each case.
The Atwood machine consists of two masses, M and m, connected by a massless string that passes over a massless pulley. The system is subject to gravity alone. The figure below shows the system along with a choice of coordinates y1 and y2 for the two masses.
These coordinates are measured from the center of the pulley and positive y1 and y2 are taken to be upward. Let’s try to use the Lagrangian formalism to find the equations of motion for this system.
But notice that y1 and y2 are no independent coordinates. If we unravel the string that is over the pulley, we find that (assume length of string is l):
where R is the radius of the pulley. That is shown in the figure below.
The equation above is called an equation of constraint. It relates the coordinates y1 and y2 to each other. We can use this equation to eliminate one of the coordinates. Let’s eliminate y2:
Notice that the first term in the above equation is the force on the mass M in the Newtonian picture: the weight of M minus the weight of m. That makes sense because the Lagrangian formalism is supposed to reproduce Newton’s laws, and the spatial derivative of the Lagrangian produces a generalized force.
Again, that is a sensible result because the Lagrangian formalism is supposed to reproduce Newton’s laws, and the generalized force is related to the time derivative of the generalized momentum.
In the previous example, we didn’t take into account the energy needed to rotate the pulley. Let’s do that now. Because the rope cannot slip, any small rotation Rdϕ of the pulley gives a change dy1 in the position of mass M. This is the no slip constraint.
If the pulley has a mass Mp and radius R, then we must introduce it’s kinetic energy:
where I is the moment of inertia of the pulley and ω is the angular velocity of the pulley, ω=ϕ˙. This angular velocity is related to the linear velocities of the masses.
This equals the generalized momentum associated with the pulley angle. The hanging masses move vertically, not tangentially around the pulley, so their contributions should be computed from their actual vertical position vectors and velocities rather than from Rr^ and Rϕ˙ϕ^.
Comparing this to the massless-pulley result y¨1=−(M+m)(M−m)g from before, we see the pulley’s moment of inertia acts like extra inertia in the denominator, slowing the whole system down. The plot below shows the distance the heavier mass M has descended after time t for a few choices of pulley mass Mp.
Source
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-v0_8-colorblind')
g = 9.8
M, m = 2.0, 1.0
t = np.linspace(0, 2, 200)
fig, ax = plt.subplots(figsize=(7, 5))
for Mp, color in zip([0, 1, 3, 6], ['C0', 'C1', 'C2', 'C3']):
a = (M - m) / (M + m + 0.5 * Mp) * g
y1 = 0.5 * a * t**2
label = 'Massless pulley' if Mp == 0 else fr'$M_p={Mp}$ kg'
ax.plot(t, y1, color=color, label=label)
ax.set_xlabel('Time (s)')
ax.set_ylabel(r'Distance descended by $M$ (m)')
ax.set_title('Effect of Pulley Inertia on the Atwood Machine')
ax.legend()
ax.grid(True)
plt.tight_layout()
plt.show()
A bead of mass m is constrained to move along a parabolic bowl. There is a gravitational force acting on the bead. The bowl is symmetric about the z-axis and the bead is constrained to move along the surface without friction or rolling. The bowl is described by the equation:
where c is a constant that describes the curvature of the bowl. The figure below shows the system.
In this case the system is better solved in cylindrical coordinates. The coordinates are (r,ϕ,z), where r is the distance from the z-axis, ϕ is the angle around the z-axis, and z is the height above the xy-plane as shown above.
With ⟨ρ,ϕ,z⟩ as the coordinates, equation for the constraint is:
There is no explicit time dependence, so we can ignore t. When the Lagrangian has no explicit time dependence, we should expect the energy to be conserved. This form of Lagrangian analysis does not account for dissipation.
Moreover, with the symmetry of the problem, we can expect no ϕ dependence. That is the gravitational potential energy only depends on z and not on ϕ. This is a consequence of the symmetry of the problem and indicates that ϕ is a cyclic coordinate. We thus expect angular momentum to be conserved about the z-axis.
We can now apply the Euler-Lagrange equations to find the equations of motion. We will do this for each coordinate. Let’s start with ϕ because there is only one term in the Lagrangian that depends on ϕ˙.
We need to write these equations in a form that is ready for numerical solution. We can do this by writing the equations in terms of the first derivatives. Let ω=ϕ˙ and v=ρ˙. We get 4 1st order equations:
Let’s integrate these equations numerically, launching the bead at ρ0=1 with ρ˙0=0 and a nonzero angular velocity ϕ˙0=1.2. We plot ρ(t) to see the radial oscillation, and reconstruct the 3D path (x,y,z) to see the bead trace out its orbit on the bowl.
Source
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
plt.style.use('seaborn-v0_8-colorblind')
g = 9.8
c = 1.0
def bead(t, state):
rho, phi, v, omega = state
drho = v
dphi = omega
dv = -(c**2 * rho * v**2 - rho * omega**2 + g * c * rho) / (1 + c**2 * rho**2)
domega = -2 * v * omega / rho
return [drho, dphi, dv, domega]
rho0, omega0 = 1.0, 1.2
state0 = [rho0, 0.0, 0.0, omega0]
t_span = (0, 15)
t_eval = np.linspace(*t_span, 3000)
sol = solve_ivp(bead, t_span, state0, t_eval=t_eval)
rho, phi, v, omega = sol.y
z = 0.5 * c * rho**2
x = rho * np.cos(phi)
y = rho * np.sin(phi)
fig = plt.figure(figsize=(11, 5))
ax1 = fig.add_subplot(1, 2, 1)
ax1.plot(sol.t, rho, 'C0')
ax1.set_xlabel('Time (s)')
ax1.set_ylabel(r'$\rho$ (m)')
ax1.set_title(r'Radial Motion $\rho(t)$')
ax1.grid(True)
ax2 = fig.add_subplot(1, 2, 2, projection='3d')
ax2.plot(x, y, z, 'C1')
ax2.set_xlabel('x')
ax2.set_ylabel('y')
ax2.set_zlabel('z')
ax2.set_title('Bead Trajectory on the Paraboloid')
plt.tight_layout()
plt.show()
The bead’s radius oscillates steadily between a minimum and maximum value rather than settling down, because there is nothing to dissipate energy in this frictionless system, while conservation of Lz=mρ2ϕ˙ forces ϕ˙ to speed up whenever ρ shrinks, tracing out the looping path on the bowl’s surface shown at right.