ME3120 · Dynamic Modelling
Theme 3 · Energy / Lagrange
Lagrange on one DOF
Everything together at last: the spring and the pendulum, derived end to end by energy — and set side by side with the Newton results from Theme 2.
Source: course notes, Week 2 worked examples A & B.
Before you start
What you need first
- The energy recipe and Lagrange's equation (Topic 12).
- Velocity from position for the pendulum bob (Topic 11).
- The Newton results to compare: \(m\ddot x+kx=0\) and \(\ddot\theta+\tfrac{g}{L}\sin\theta=0\).
What you'll be able to do
- Derive the spring equation by energy, end to end.
- Derive the pendulum equation by energy — tension never appears.
- Say when Lagrange beats Newton.
The recipe, in one line
$$\text{choose } q \;\to\; T \;\to\; V \;\to\; \mathcal{L}=T-V \;\to\; \frac{d}{dt}\!\left(\frac{\partial \mathcal{L}}{\partial \dot q}\right)-\frac{\partial \mathcal{L}}{\partial q}=Q \;\to\; \text{check}$$
We now run this exact recipe twice — on the spring, then the pendulum — and get
the Theme 2 answers without drawing a single force.
The mass–spring, by energy
Mass \(m\), spring \(k\), coordinate \(x\) from rest.
1Kinetic energy:
$$T=\tfrac12 m\dot x^{2}$$
2Potential energy (spring):
$$V=\tfrac12 k x^{2}$$
3Lagrangian:
$$\mathcal{L}=\tfrac12 m\dot x^{2}-\tfrac12 k x^{2}$$
4Momentum term — differentiate by \(\dot x\), then by time:
$$\frac{\partial \mathcal{L}}{\partial \dot x}=m\dot x \quad\Longrightarrow\quad \frac{d}{dt}\!\left(\frac{\partial \mathcal{L}}{\partial \dot x}\right)=m\ddot x$$
5Position term — differentiate by \(x\):
$$\frac{\partial \mathcal{L}}{\partial x}=-k x$$
6Assemble (\(Q=0\)):
$$m\ddot x + k x = 0$$
Identical to the Newton answer ✓ — built from two scalars, no free-body diagram.
The pendulum, by energy — the pay-off
Bob mass \(m\), rod \(L\), angle \(\theta\). One coordinate.
1Speed of the bob (from Topic 11):
$$v^{2}=L^{2}\dot\theta^{2}$$
2Kinetic energy:
$$T=\tfrac12 m L^{2}\dot\theta^{2}$$
3Potential energy (rise \(L(1-\cos\theta)\)):
$$V=mgL(1-\cos\theta)$$
4Lagrangian:
$$\mathcal{L}=\tfrac12 m L^{2}\dot\theta^{2}-mgL(1-\cos\theta)$$
5Momentum term:
$$\frac{\partial \mathcal{L}}{\partial \dot\theta}=mL^{2}\dot\theta \quad\Longrightarrow\quad \frac{d}{dt}\!\left(\frac{\partial \mathcal{L}}{\partial \dot\theta}\right)=mL^{2}\ddot\theta$$
6Position term (only \(V\) depends on \(\theta\)):
$$\frac{\partial \mathcal{L}}{\partial \theta}=-mgL\sin\theta$$
7Assemble and divide by \(mL^{2}\):
$$mL^{2}\ddot\theta+mgL\sin\theta=0 \;\Longrightarrow\; \ddot\theta+\frac{g}{L}\sin\theta=0$$
Identical to the Newton answer ✓ — and the rod tension never appeared.
That is the whole pay-off of the energy method.
Newton vs Lagrange — side by side
| Newton (Theme 2) | Lagrange (this theme) | |
|---|---|---|
| Start from | forces & free-body diagram | energies \(T\) and \(V\) |
| Constraint forces | must find them, then cancel | never appear |
| Geometry | track force vectors carefully | scalars only — no vector balancing |
| Many DOF | gets messy fast | same recipe, repeated per coordinate |
Same equation of motion, far less work. For one simple body it is a tie; for a
multi-joint robot, Lagrange wins every time.
✏️ Try it yourself
Re-derive the vertical mass–spring by Lagrange. Let \(y\) be measured downward from the spring's natural length, so \(T=\tfrac12 m\dot y^2\) and \(V=\tfrac12 k y^2 - mgy\) (spring stores energy; gravity lowers it). With \(Q=0\), find the equation of motion.
Lagrangian.
\(\mathcal{L}=\tfrac12 m\dot y^2 - \tfrac12 k y^2 + mgy\)
Momentum term.
\(\dfrac{\partial \mathcal{L}}{\partial \dot y}=m\dot y \Rightarrow \dfrac{d}{dt}(m\dot y)=m\ddot y\)
Position term.
\(\dfrac{\partial \mathcal{L}}{\partial y}=-ky+mg\)
Assemble.
\(m\ddot y-(-ky+mg)=0 \Rightarrow m\ddot y + ky = mg\). It rests at
\(y_{\text{eq}}=mg/k\), the static stretch. ✓
Common mistakes to avoid
| Mistake | Fix |
|---|---|
| Trying to add the rod tension to \(T\) or \(V\) | Constraint forces never enter energy — that is exactly why Lagrange is clean. |
| Using \(V=mgL\cos\theta\) with the wrong sign | The bob rises \(L(1-\cos\theta)\); a sign slip flips the gravity term. |
| Forgetting the chain rule in \(v^2\) | \(v^2=L^2\dot\theta^2\) — the \(\dot\theta\) comes from differentiating the position. |
| Dropping the gravity term in the vertical spring | With \(y\) down, gravity adds \(+mgy\) to \(\mathcal{L}\) and a \(mg\) to the right side. |
Recap — the whole topic on one screen
$$\text{spring: } m\ddot x + kx = 0 \qquad\qquad \text{pendulum: } \ddot\theta+\tfrac{g}{L}\sin\theta=0$$
| Idea | What you own now |
|---|---|
| Spring by energy | \(T,V \to \mathcal{L} \to\) crank \(\to m\ddot x+kx=0\) |
| Pendulum by energy | Same recipe \(\to \ddot\theta+\tfrac{g}{L}\sin\theta=0\), no tension |
| Why it wins | Scalars, no constraint forces, same recipe for any DOF |