A swinging Atwood machine consists of two noncolliding masses connected by an inextensible string over two frictionless support points. The motion of the swinging mass can be regular or chaotic depending on initial conditions. This interactive graphic allows one to explore the motion as a function of those conditions:

In practice the horizontal part of the string should be long enough to prevent collisions of the two masses. The depiction here is an idealization in that respect to keep the graphic compact.

To derive the equations of motion for the system, let r designate the distance of the swinging mass from its point of support and φ its angle from the vertical. The Lagrangian for the swinging mass is

$Lswinging =m2( r·2 +r2 φ· 2) +mgrcosφ$

Since the string is of constant length, the distance of the counterweight from its point of support is that length less r. The Lagrangian of the counterweight is

$Lcounter =M2 [ddt (l-r) ]2 +Mg (l-r) =M2 r·2 -Mgr$

where the constant term in the potential can be ignored. Adding together the two contributions, the raw Lagrange equations are

$(M+m) r·· =mr φ·2 +mgcosφ-Mg mr2 φ·· +2mr r· φ· =−mgrsinφ$

Introducing the mass ratio $μ=Mm$ and cancelling common factors in the second equation, the system to be integrated is

$r·· =r φ·2 +gcosφ -μg 1+μ φ·· =−2 r· φ· +gsinφr$

The numerical integration is readily handled by Math and the graphic presentation by MathCell, a pair of JavaScript libraries designed for higher-level interactive mathematics in the browser.