Test post: Site design in progress

Misc
Author

Yijia Zhao

Published

February 7, 2026

Defination

Here is the Euler-Lagrange’s equation:

\[ \frac{\mathrm{d}}{\mathrm{d}t}(\frac{\partial{\mathcal{L}}}{\partial{\dot{q_i}}})=\frac{\partial{\mathcal{L}}}{\partial{q_i}} \tag{1}\]

Where \(\mathcal{L}\) is the Lagrangian, defined as \(T-V\).
In Mathematica, we can compute it directly by calling the VariationalMethods package:

Needs["VariationalMethods`"]
L = T - V
EulerEquations[L, {q1[t], q2[t]}, t]

Example

Simple pendulum

Choose the angular displacement \(\theta\) (the angle between the pendulum and the vertical) as the generalized coordinate.

\[ \mathcal{L} =\frac{1}{2}ml^2 \dot{\theta}^2+mgl\cos{\theta} \tag{2}\]

Which set \(V=0\) at the pivot point. Use Euler-Lagrange equation, we have: \[ l\ddot{\theta}+g\sin{\theta}=0 \tag{3}\]

Solution

\[ \dot{\theta}\ddot{\theta}+\frac{g}{l}\dot{\theta}\sin{\theta}=0 \\ \tag{4}\] \[ \frac{\mathrm{d}}{\mathrm{d}t}(\frac{1}{2}\dot{\theta}^2-\frac{g}{l}\cos{\theta})=0 \tag{5}\]

Let \(\theta=\theta_0\) when \(t=0\) : \[ \dot{\theta}^2=\frac{2g}{l}(\cos{\theta}-\cos{\theta_0}) \tag{6}\] \[ t=\sqrt{\frac{l}{2g}} \int_0^{\theta} \frac{1}{\sqrt{\cos{\theta}-\cos{\theta_0}}}\mathrm{d}\theta \tag{7}\]

Use double-angle formula \(\cos{2x}=1-2\sin{x}^2\) and let \(\sin{\frac{\theta}{2}}=k\sin{\phi}\) : \[ t=\sqrt{\frac{l}{g}}\int_0^{\arcsin{\frac{1}{k}\sin{\frac{\theta}{2}}}}\frac{1}{\sqrt{1-k^2\sin{\phi}^2}} \mathrm{d}\phi \tag{8}\]

Where \(k=\sin{\frac{\theta_0}{2}}\). For the period \(T\), the process is \(\theta_0 \to 0 \to -\theta_0 \to 0\) , so: \[ T=4\sqrt{\frac{l}{g}}\int_0^{\pi/2}\frac{1}{\sqrt{1-k^2\sin{\phi}^2}} \mathrm{d}\phi \tag{9}\]

This is the Complete Elliptic Integral of the first Kind, which can be written as: \[ T=4\sqrt{\frac{l}{g}}K\left(\sin{\left( \frac{\theta_0}{2} \right)}\right) \tag{10}\]

Using the power series expansion of \(K(k)\) , we obtain: \[ T=2\pi\sqrt{\frac{l}{g}}\sum_{n=0}^{\infty}\left( \frac{(2n)!}{2^{2n}(n!)} \right)^2 \sin^{2n}\left( \frac{\theta_0}{2} \right) \tag{11}\]