A pendulum making 90-degree swings

The exact classical mechanical description of a pendulum is quite complex, and the equations of motion usually only solved in introductory texts for small displacements about equilibrium. In this case, the period, $T \approx 2\pi\sqrt{L/g}$, and the motion is harmonic.

The general solution requires elliptic integrals, but the special case of a pendulum making $180^\circ$ swings (i.e. $\pm 90^\circ$ about its equilibrium position) leads to the following expression for the period: $$ T = 2\sqrt{\frac{2l}{g}}\int_0^{\pi/2} \frac{\mathrm{d}\theta}{\sqrt{\cos\theta}}. $$

The substitution $x = \sin^2\theta$ transforms this integral into a beta function: $$ \int_0^{\pi/2} \frac{\mathrm{d}\theta}{\sqrt{\cos\theta}} = \textstyle \frac{1}{2}\int_0^1 x^{-1/2}(1-x)^{-3/4}\,\mathrm{d}x = \textstyle\frac{1}{2}B(\frac{1}{2},\frac{1}{4}). $$ Therefore, $$ T = \sqrt{2}B(\textstyle\frac{1}{2},\frac{1}{4})\sqrt{\frac{l}{g}}. $$

To find the period of the pendulum in units of $\sqrt{l/g}$:

In [x]: import numpy as np
In [x]: from scipy.special import beta
In [x]: np.sqrt(2) * beta(0.5, 0.25)

(Compare with the harmonic approximation, $2\pi= 6.283185$).