E(\theta,\dot\theta) =
        T(\dot\theta)+U(\theta)$.  The undamped pendulum is a conservative
        system: total energy is a constant over system trajectories.  Using
        conservation of energy, we have:

        \begin{gather*}  E(\theta(t),\dot\theta(t)) = E(\theta(0),\dot\theta(0))
        = E_0 \\ \frac{1}{2} I \dot\theta^2(t) - mgl\cos(\theta(t)) = E_0  \\
        \dot\theta(t) = \pm \sqrt{\frac{2}{I}\left[E_0 +
        mgl\cos\left(\theta(t)\right)\right]} \end{gather*}

        Using this,