# Partition function of a classical spring

Hello. I come across a problem: how to calculate the partition function of a classical spring whose energy is 1/2kx^2, and use thermodynamics to show that the force on the spring is linearly proportional to its elongation x?

I got stuck at the first step. What is the energy of the spring, is it (1/2)kx^2 or (1/2)(p^2/2)+(1/2)kx^2?

I believe you're becoming confused between a spring and an oscillator. Although the question is vague, I don't think that the spring (and hence any mass attatched to it) is actually moving - this makes the (1/2)mv^2 term equal to zero.

So for a spring under a constant tension (i.e. no oscillation) will have energy (1/2)kx^2.

Hope this helps.