Sum to an integral in deriving equipartition theorem I'm reading this derivation of the equipartition theorem for ideal gases. On the second page, it is mentioned that the partition function as a simple sum,
$${\displaystyle Z=\sum _{i}e^{-\varepsilon _{i}/kT}}$$
is not adequate to describe a classical gas as the distribution of energies is not discrete, but continuous. Instead, an integral is needed where 
$$e^{-\varepsilon/kT}$$
is integrated over positions and momenta of which energy is a function of. But why is this conversion from a sum to an integral correct?
I can understand why an integral is needed, as the distribution of energies is continuous. But why is it correct to just integrate the exponential function to get the sum? Doesn't the integral give us the area under the curve of the exponential function, that is (speaking perhaps non-rigorously), the sum of the values of the function at different points, multiplied by the differentials $dx$, rather than the simple sum of the values? I've seen this kind of thing done in other places as well, and it bugs me.
 A: Whenever a sum goes to an integral in the continuous limit, you need to take account of the issue raised by this question. When in doubt, proceed in two steps, as follows.


*

*First write the sum with an explicit 'delta something' to signify the change in the index being summed over. In the present example:


\begin{equation}
Z = \sum_i e^{-\epsilon_i/kT} \delta i
\end{equation}
The value of this $\delta i$ is 1 in this sum.


*Next, replace $\delta i$ by the product of a density of something and a change in that something. In the present example, you should ask, "how many states are there per unit range of $x,y,z$ and $p_x, p_y, p_z$? The answer is one state per volume $h^3$ of phase space. The value $\delta i = 1$ represents the count in $Z$ increasing by 1 state, so the relationship is


\begin{equation}
\delta i = \delta x \delta y \delta z \delta p_x \delta p_y \delta p_z / h^3
\end{equation}
which gives us
\begin{equation}
Z = \sum_i e^{-\epsilon_i/kT} \delta x \delta y \delta z \delta p_x \delta p_y \delta p_z / h^3
\end{equation}
Now the continuous limit can be taken:
\begin{equation}
Z = \int  e^{-\epsilon_i/kT} dx dy dz\, dp_x dp_y dp_z / h^3
\end{equation}
where the integral sign is a shorthand for six integrals in this example.
That's it. To repeat: this issue comes up whenever a sum goes to an integral; it is not a special feature of kinetic theory or statistical mechanics. I guess some textbook writers simply assume it as a known aspect of this area of mathematics.
A: 
But why is this conversion from a sum to an integral correct?

There is no conversion. The partition function is defined as integral in classical statistical physics, because the possible states form a continuous set and it is the most natural definition.
In pseudo-quantum (or old quantum) statistical physics, "state" in the partition function means different thing (a tuple of all quantum numbers that define preferred quantum state, like nx,ny,nz for 3D harmonic oscillator defining Hamiltonian eigenfunction, or occupation numbers of all particle sites) and all such possible states form a discrete set, so the most natural definition is a sum.
