Back

Pendulum on a moving cart

What you are seeing: a frictionless cart of mass MM constrained to move horizontally, with a rigid pendulum of length LL and bob mass mm hanging from a pivot on top of the cart. Classical two-degree-of-freedom Lagrangian system. Both energy and total horizontal momentum are conserved (no external horizontal forces).

Release the pendulum from angle θ0\theta_0 and watch it swing. The cart slides to keep total px=(M+m)x˙+mLcosθθ˙p_x = (M+m) \dot{x} + m L \cos\theta \, \dot\theta constant. The traces below show energy drift (tiny under RK4) and the θ\theta vs cart-xx phase portrait.

Figure 1. Cart-pendulum dynamics. Method: RK4 on coupled Euler-Lagrange equations.
theta_00.80
speed3

WHAT TO TRY

  • Vary each control and watch the rail readouts respond.
  • Compare the diagnostic plot against the live scene.