Continuous Transition of Degrees of Freedom in Thermodynamics With Simple Example In thermodynamics books I have read, I have often come across statements about how certain degrees of freedom are relevant only at certain temperatures (such as the vibration degrees of freedom of some molecules only being relevant in certain ranges), but I can't recall a convincing quantitative analysis of this. I tried to set up a simple example to explore this issue, but I'm unsure what goes wrong (though I haven't thought TOO much about it).  
We know that for a free particle in one dimension at finite temperature, the partition function is given by:
$$Z(\beta)=\frac{L}{h}\int \text{d}p e^{-\beta p^2/2m}=\frac{L}{h}\sqrt{\frac{2 \pi m}{\beta}}$$
And then our expected energy is just:
$$\langle E \rangle =\frac{1}{2}k_B T$$
Which we'd expect for a particle with one degree of freedom. 
On the other hand, the partition function for a particle in a 1-D harmonic potential is:
$$Z(\beta)=\frac{1}{h}\int \text{d}x \int \text{d}p e^{-\beta(kx^2+p^2/m)/2}=\frac{2\pi}{\beta h\omega}$$
Which gives the expected energy:
$$\langle E \rangle = k_BT$$
Here's my problem. If we take a limit of the spring constant to zero ($k \rightarrow 0$), doesn't that just correspond to a free particle? The average energies depend ONLY on temperature, so where does this limit come in? 
 A: This is a good question. You've kind of hinted at the source of the discrepancy yourself. What are the limits of the position integral? In reality, it's from $-L/2$ to $L/2$, as you've already used in the free particle case.
So the partition function for the harmonic oscillator is:
$$\mathcal Z = \frac1h \int_{-L/2}^{L/2} dx \int _{-\infty}^{\infty}dp \ e^{-\frac{\beta}2(kx^2+p^2/m)}=\frac1h \sqrt{\frac{2\pi m}{\beta}}\int_{-L/2}^{L/2} dx\ e^{-\frac{\beta}2kx^2}$$
Now typically, since the size of the system is implicitly assumed to be big, the limits can be approximately set to infinity. This is especially due to the fact that the gaussian function rapidly goes to zero for large $x$, so that the region from $[L,\infty)$ doesn't really contribute to the integral that much. The precise condition for this approximation to hold is that the spread of the gaussian needs to be much smaller than the size of the system. i.e. $L\gg1/\sqrt{\beta k}$. 
Note that this also means that the approximation fails to hold at infinite temperature ($\beta \to 0$), which exactly hints at what you said about the importance of certain degrees of freedom depending on temperature.

However, since you're taking the limit $k\to 0$, this approximation doesn't hold anymore. Making your result inconsistent. 
Let's now calculate the average energy from the exact partition function instead:
$$\langle E \rangle = - \frac{\partial}{\partial \beta}\ln \mathcal Z=-\frac1{\mathcal Z}\frac{\partial \mathcal Z}{\partial \beta}$$
$$=\frac{-\frac{\partial}{\partial \beta}\Big[\frac1h \sqrt{\frac{2\pi m}{\beta}}\int_{-L/2}^{L/2} dx\ e^{-\frac{\beta}2kx^2}\Big]}{\frac1h \sqrt{\frac{2\pi m}{\beta}}\int_{-L/2}^{L/2} dx\ e^{-\frac{\beta}2kx^2}}$$
$$=\frac{\frac12\beta^{-3/2}\int_{-L/2}^{L/2}dx \ [1+\beta k x^2]e^{-\frac{\beta}2kx^2}}{{{\beta^{-1/2}}}\int_{-L/2}^{L/2} dx\ e^{-\frac{\beta}2kx^2}}$$
Now these sorts of integrals don't have elementary solutions. The integral of a gaussian function on an arbitrary domain is usually given in terms of the error function, which is defined as $\mathrm{erf}(x)\equiv \frac{1}{\sqrt \pi}\int_{-x}^x dt \exp(-t^2)$. Using this, we get (via Wolfram Alpha):
$$\langle E \rangle =\frac{\sqrt{\frac{2\pi}{k\beta}}\mathrm{erf}(\sqrt{\frac{\beta k}{8}}L)-\frac L2 e^{-\beta k L^2/8}}{\beta\sqrt{\frac{2\pi}{k\beta}}\mathrm{erf}(\sqrt{\frac{\beta k}{8}}L)}$$
Now we can check the two limits. For the big $k$ limit we should get our approximate result (which we got by replacing the integration limits by infinity):
$$\lim_{k \to +\infty} \langle E \rangle = \lim_{k \to +\infty} \frac{\sqrt{\frac{2\pi}{k\beta}}\mathrm{erf}(\sqrt{\frac{\beta k}{8}}L)-0}{\beta\sqrt{\frac{2\pi}{k\beta}}\mathrm{erf}(\sqrt{\frac{\beta k}{8}}L)}=\frac1{\beta}=k_B T$$
As expected. For the small $k$ limit, we can use the Taylor expansion $\mathrm{erf}(L\sqrt{\frac{k\beta}8})=\frac{2}{\sqrt{\pi}}L\sqrt{\frac{k\beta}8} +O(k^2\beta^2)$ to get:
$$\lim_{k \to 0} \langle E \rangle =\lim_{k \to 0}\frac{\sqrt{\frac{2\pi}{k\beta}}\frac{2}{\sqrt \pi}(\sqrt{\frac{\beta k}{8}}L)-\frac L2}{\beta\sqrt{\frac{2\pi}{k\beta}}\frac{2}{\sqrt \pi}(\sqrt{\frac{\beta k}{8}}L)}=\frac{1-\frac12}{\beta }=\frac1{2\beta}$$
In other words:
$$\lim_{k \to 0} \langle E \rangle = \frac12 k_B T$$
So there is indeed no discrepancy!
Notice that even for big values of the spring constant, the same limit would be achieved through $\beta \to 0$, i.e. really high temperatures (we actually took the limit $k\times \beta \to 0$ here using the Taylor expansion). Essentially, at a high enough temperature, thermal fluctuations are so big that the particle doesn't "see" the spring anymore and basically behaves like a free particle.
