smish.dev
lagrangian-derivation

Problem Statement

Someone posted a question on reddit, asking for the equations of motion for a complicated mechanical system:

A complicated mechanical system

At the time of writing, no one actually answered the question and the comments are just variations on "it's ugly and not solvable in closed form". In practice, it's not that ugly after all, and practically no mechanical systems are solvable in closed form, but that doesn't stop us from accurately simulating the system's behavior.

So, in this document, we'll walk through the classical mechanics of how to derive and simulate this system by briefly reviewing the fundamentals of classical mechanic and working up to actual system of interest, one feature at a time.

Classical Mechanics Review

The main idea of Lagrangian mechanics is to derive the equations of motion indirectly, by first thinking about the kinetic energy, T, and potential energy, V, of a system. The advantage here is that many systems (like the one we're studying here) would be practically impossible to analyze with Newtonian mechanics. As my classical mechanics professor used to say, someone trying to describe these kinds of systems in the Newtonian way would experience "an algebraic death"!

For coordinates q, the Lagrangian is L(q,q˙)=T−V, and the motion makes the action ∫Ldt stationary, which gives

ddt∂L∂q˙i−∂L∂qi=0.

Every system below has T=12q˙⊤M(q)q˙ and V=V(q). Then

∂L∂q˙i=∑jMijq˙j,ddt∂L∂q˙i=∑jMijq¨j+∑j,k∂Mij∂qkq˙jq˙k,∂L∂qi=12∑j,k∂Mjk∂qiq˙jq˙k−∂V∂qi,

so the equations of motion are

M(q)q¨+h(q,q˙)+∇V(q)=0,hi=∑j,k(∂Mij∂qk−12∂Mjk∂qi)q˙jq˙k

Each stage therefore only needs M and V.

 

The rocking-arc pendulum, one body at a time

The complete system, labeled as in the video

1. The rocking arc

Start simple by just analyzing how the large arc rocks back and forth.

Stage 1: the rocking shell

We assume it rolls on the ground without slipping, and as it does, its potential energy is given by the height of its center of mass:

V1=Mgd(1−cos⁡θ)

where d=4(Ro3−Ri3)3π(Ro2−Ri2). The kinetic energy for this system depends on the arc's own moment of inertia about its center,

IO=M2(Ro2+Ri2)

but also has a parallel axis theorem contribution from the fact that it's not rotating about that point. When rolling, the arc instantaneously rotates about the contact point C, so its effective moment of inertia is IC=IG+M|CG|2. With IG=IO−Md2 and, by the law of cosines in the triangle C–O–G ( |CO|=Ro, |OG|=d, angle θ between them),

|CG|2=Ro2+d2−2Rodcos⁡θ⟹IC=IO+MRo2−2MRodcos⁡θ,

so

T1=12(IO+MRo2−2MRodcos⁡(θ))⏟A0(θ)θ˙2

which, after differentiation gives us the equation of motion

A0(θ)θ¨+MRodsin⁡θθ˙2+Mgdsin⁡θ=0

 

 

 

2. Adding the rolling disk

Stage 2: shell plus rolling disk

The disk center is rP=rO+ρu(β) with ρ=Ri−r. No slip at the inner contact gives the spin φ˙=(Riθ˙−ρβ˙)/r.

The potential contribution of this disk is simple, we just need to add a contribution proportional to its center of mass vertical coordinate:

V2=V1+mrgρ(1−cos⁡β)

The kinetic contribution has terms due to its own the translational and rotational energy, as well as a term from the coupling of its position to the rocking arc.

T2=T1+12mr|r˙P|2+12κmr(Riθ˙−ρβ˙)2,|r˙P|2=Ro2θ˙2−2Roρcos⁡βθ˙β˙+ρ2β˙2

Those two contributions update our equations of motion, giving us a new effective mass matrix

M2=(ABBD),A=A0(θ)+mrRo2+κmrRi2B=−mrRoρcos⁡β−κmrRiρD=(1+κ)mrρ2
Aθ¨+Bβ¨+MRodsin⁡θθ˙2+mrRoρsin⁡ββ˙2+Mgdsin⁡θ=0Bθ¨+Dβ¨+mrgρsin⁡β=0

 

 

3. Adding the hinged pendulum

Stage 3: shell, disk and hinged pendulum

The bobs hang from a frictionless hinge at P: r±=rP+lpu(α)±wp2t(α). With m=2mp and J=m(lp2+14wp2):

T3=T2+12m|r˙P|2+mlpα˙(−Rocos⁡αθ˙+ρcos⁡(β−α)β˙)+12Jα˙2
V3=V2+mgρ(1−cos⁡β)+mglp(1−cos⁡α)

With μ=mr+m,

M3=(ABEBDFEFJ),A=A0(θ)+μRo2+κmrRi2B=−μRoρcos⁡β−κmrRiρD=(μ+κmr)ρ2E=−mlpRocos⁡αF=mlpρcos⁡(β−α)
h3=(MRodsin⁡θθ˙2+μRoρsin⁡ββ˙2+mlpRosin⁡αα˙2mlpρsin⁡(β−α)α˙2−mlpρsin⁡(β−α)β˙2),∇V3=(Mgdsin⁡θμgρsin⁡βmglpsin⁡α)
M3q¨+h3+∇V3=0

 

 

4. Adding the springs

Stage 4: spring geometry

The side springs run from a±=(±ds,0) to shell points B±=rO+Q(θ)(±Rocos⁡βs,−Rosin⁡βs), where Q is a rotation; the center spring runs from P to rQ=rO+Rau(θ). Their lengths are

L±=|B±−a±|,s=Ra2+ρ2−2Raρcos⁡(β−θ),

and with rest lengths L0, s0 (unstretched at q=0),

T4=T3,V4=V3+k2[(L+−L0)2+(L−−L0)2+(s−s0)2]
∇V4=∇V3+(τ−ff0),τ=k∑±(L±−L0)dL±dθ,f=k(s−s0)Raρsin⁡(β−θ)s
M3q¨+h3+∇V4=0

Just for fun, we also plot the sum of the different kinetic and potential energy terms for the ball, arc, pendulum and springs to verify that the total energy is conserved.