Solution (source code)

= Solution

For $\omega>0$, the <quantum harmonic oscillator> has energies $E_r=\omega(r+1/2)$, $r=0,1,\ldots$, in units $\hbar=1$. For positive <inverse temperature> $\beta$, taking the <trace> in the energy basis and summing a <geometric series> gives
$$
\boxed{\mathcal Z(\omega,\beta)=\frac{e^{-\beta\omega/2}}{1-e^{-\beta\omega}}=\frac1{2\sinh(\beta\omega/2)}.}
$$
This is the <thermal partition function of a quantum harmonic oscillator>, including its <zero-point energy>. The assumptions $\beta,\omega>0$ ensure convergence; at $\omega=0$ the free particle on the noncompact line instead has an infinite spatial-volume factor.