Solution (source code)

= Solution

For a dilute linear <diatomic gas> with fixed molecular number, <translation> contributes molar $C_V=3R/2$. Rotational levels are $E_J=\hbar^2J(J+1)/(2I)$ with degeneracy $2J+1$:
$$
Z_{\rm rot}=\sum_{J=0}^\infty(2J+1)e^{-\theta_rJ(J+1)/T},\qquad
\theta_r=\frac{\hbar^2}{2Ik_B}.
$$
At $T\ll\theta_r$ rotational excitation is frozen out; at $T\gg\theta_r$ the <partition function> is proportional to $T$, giving $U_{\rm rot}=Nk_BT$ and $C_{V,\rm rot}=Nk_B$. Nuclear-spin populations and molecular <symmetry> modify detailed low-temperature behaviour. The high-temperature result corresponds to two quadratic rotational <degrees of freedom>; a nonlinear molecule has three and contributes $3Nk_B/2$.

For each independent harmonic vibration, write $x=\hbar\omega/(k_BT)$. Its <energy> and <heat capacity> are
$$
U_{\rm vib}=N\hbar\omega\left(\frac12+\frac1{e^x-1}\right),\qquad
\boxed{C_{V,\rm vib}=Nk_B\frac{x^2e^x}{(e^x-1)^2}}.
$$
The contribution is exponentially small at low <temperature> and approaches $Nk_B$ per mode at high <temperature>. <zero-point energy> does not contribute to $dU/dT$. Typically <rotations> activate before bond stretching, producing diatomic plateaus \b[$C_V/R=3/2,5/2,7/2$] as <temperature> increases within the molecular regime; ideal-gas $C_P=C_V+R$. Dissociation, electronic excitation and nonideal interactions eventually invalidate this simple sequence. Polyatomic gases sum over their distinct vibrational <frequencies>; no single activation <temperature> describes all modes.