# Classical harmonic oscillator deviation of energy (canonical ensemble)

Consider the classical harmonic oscillator with Hamiltonian $$H = \frac{p^2}{2m}+\frac{1}{2}m \omega^2x^2$$ in a canonical ensemble, i. e. in thermal equillibrium with a thermal bath. What is the deviation of the energy? How does the deviation change when $\omega \rightarrow 0$?

Its canonical partition function is $$Z = \frac{1}{h} \int \int e^{- \beta H} \, dx \, dp = \frac{1}{h} \int e^{-\frac{\beta }{2m}p^2} \, dp \int e^{-\frac{\beta m \omega^2}{2} x^2} \, dx = \frac{1}{\hbar \beta \omega}.$$ In theory, the deviation of energy would be $$\langle \Delta E \rangle = \sqrt{\frac{\partial^2 \log Z}{\partial \beta^2}} = \frac{1}{\beta} = kT.$$ Now I am interested in the case $\omega \rightarrow 0$. From the result above, the deviation should not change. However, if we let $\omega = 0$ in the Hamiltonian, we get $$Z' = \int \int e^{- \frac{\beta }{2m}p^2} \, dp \, dx = \int \, dx \int e^{- \frac{\beta}{2m}p^2} \, dp= \frac{L}{h} \sqrt{\frac{2 \pi m}{\beta}},$$ where L is the volume in which the oscillator is present (this might be wrong to assume; for 3 dimensional free particles however, the $dx^3$-integral becomes V, and the pV = NkT equation is easily derived, so V is a limited volume).

Differentiating $Z'$ twice: $$\langle \Delta E \rangle = \sqrt{\frac{1}{2\beta^2}} = \frac{kT}{\sqrt{2}}.$$ Why aren't the two results equal?

As $\omega \to 0$, we get $\langle x^2 \rangle \to \infty$ but $\langle \omega^2 x^2 \rangle = const$. The probability distribution of $x$ gets wider, but still contributes the same potential energy.
When you set $\omega = 0$, then $\langle x^2 \rangle$ is poorly defined - you could say it's infinite, or relate it to the volume like you have. However, $\langle \omega^2 x^2 \rangle$ is well-defined and equal to zero.