I'm following this derivation of the equipartition theorem:
http://vallance.chem.ox.ac.uk/pdfs/Equipartition.pdf
On the second page, it is said that a standard result from statistical mechanics is this:
$$U = kT ^{2} \frac{d(ln(q))}{dT} $$
That is, the internal energy is proportional to the derivative of the logarithm of the number of states.
How is this expression obtained from statistical mechanics? I'm aware of the Maxwell-Boltzmann statistics, but I haven't been able to derive this relationship nor have I found a derivation online.