Harmonic oscillator: if $E=\frac{1}{2} q \dot{\theta}^2+\frac{1}{2} s \theta^2$ then $\omega=\sqrt{\frac{s}{q}}$? Consider an harmonic oscillator. Suppose that I manage to write the mechanical energy as a function of a quantity, like the angle $\theta$ in this way
$$E=\frac{1}{2} q \dot{\theta}^2+\frac{1}{2} s \theta^2$$
With $s$ and $q$ costants. Then
$$\omega=\sqrt{\frac{s}{q}}.$$
Is this correct? If so I don't understand the reason of that.
Can someone help me to understand why does this hold?
 A: The point of the energy in any system is that it is constant in time$^1$, which means $\dot E=0$. In this specific case,
$$
E=\frac{1}{2}q\dot\theta^2+\frac{1}{2}s\theta^2
$$
which upon time-differentiation$^2$ becomes
$$
\dot E=q\dot\theta\ddot\theta+s\theta\dot\theta
$$
If you set this equal to zero, you get
$$
\ddot\theta+\frac{s}{q}\theta=0
$$
which is just the equation for harmonic motion, where you can read off$^3$ the frequency as $\omega^2=s/q$.

$^1$ the energy is constant in almost any situation, but sometimes (e.g., where the forces are not conservative, such as friction) $E$ might change in time. I assume this is familiar to you.
$^2$ note that here I use the chain rule: $\frac{\mathrm d}{\mathrm dt}f(\theta)=f'(\theta)\dot\theta$.
$^3$ the general solution of this equation is $\theta(t)=a\cos\left(\sqrt{s/q}\;t+\phi\right)$, where $a,\phi$ are constants of integration. You can check this by pluging this expression into the equation, and verify that it works. From this, it should be clear that the frequency is given by the square root $\sqrt{s/q}$, as we wanted to prove.
