Consider the classical harmonic oscillator with Hamiltonian \begin{equation} H = \frac{p^2}{2m}+\frac{1}{2}m \omega^2x^2 \end{equation} 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 \begin{equation} 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}. \end{equation} In theory, the deviation of energy would be \begin{equation} \langle \Delta E \rangle = \sqrt{\frac{\partial^2 \log Z}{\partial \beta^2}} = \frac{1}{\beta} = kT. \end{equation} 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 \begin{equation} 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}}, \end{equation} 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: \begin{equation} \langle \Delta E \rangle = \sqrt{\frac{1}{2\beta^2}} = \frac{kT}{\sqrt{2}}. \end{equation} Why aren't the two results equal?