Density of states misunderstanding in Statistical Mechanics In the simple model of a box filled with an ideal gas, one may write the total energy as the sum of kinetic energies of all particles
$$E = \sum_{i=1}^N\frac{\vec{p}_i^2}{2m}$$
and so if you construct the partition function $Z(\beta) = \sum_se^{-\beta E_s}$ in the continuum, I have seen this written as
$$Z = \frac{1}{N!}\frac{1}{h^{3N}}\prod_{i=1}^N\int d^3x_id^3p_i\exp{\left(-\beta\sum_{i=1}^N\frac{\vec{p}_i^2}{2m}\right)}$$
Should there not be a density of states attached in the integrand? I thought whenever one goes from a discrete sum to an integral, there is always a density of states attached, ala
$$\sum_i \rightarrow\int D(\epsilon)d\epsilon$$
Is that where this prefactor of $\frac{1}{N!}\frac{1}{h^{3N}}$ comes from? What exactly is going on here?
 A: The energy levels for a particle in a box are $E_n = \frac{\hbar^2 \pi^2 |n|^2}{2 m L^2}$ where $n \in \mathbb N^3$. So what we're doing is
\begin{align*}
Z &= \prod_{i=1}^N\left[\sum_{n^{(i)} \in \mathbb N^3}\right] \exp\left(-\beta \sum_{j=1}^N E_{n^{(j)}} \right)\\
&\approx \prod_{i=1}^N\left[ \int_{\mathbb R_{>0}^3} d^3n^{(i)}\right]  \exp\left(-\beta \sum_{j=1}^N E_{n^{(j)}} \right)\\
&= \prod_{i=1}^N\left[ \frac{L^3}{8\pi^3}\int_{\mathbb R^3} d^3k^{(i)}\right]  \exp\left(-\beta \sum_{j=1}^N \frac{\hbar^2 |k^{(j)}|^2}{2m} \right)\\
&= \prod_{i=1}^N\left[\frac{1}{8\pi^3}\int d^3 x^{(i)}d^3k^{(i)} \right] \exp\left(-\beta \sum_{j=1}^N \frac{\hbar^2 |k^{(j)}|^2}{2m} \right)\\
&= \prod_{i=1}^N\left[ \frac{1}{8\hbar^3 \pi^3}\int d^3 x^{(i)}d^3p^{(i)} \right] \exp\left(-\beta \sum_{j=1}^N \frac{|p^{(j)}|^2}{2m} \right)\\
&= \prod_{i=1}^N\left[\frac{1}{h^3}\int d^3 x^{(i)}d^3p^{(i)} \right] \exp\left(-\beta \sum_{j=1}^N \frac{|p^{(j)}|^2}{2m} \right)\\
&= \frac{1}{h^{3N}} \prod_{i=1}^N\left[\int d^3 x^{(i)}d^3p^{(i)}\right]  \exp\left(-\beta \sum_{j=1}^N \frac{|p^{(j)}|^2}{2m} \right).
\end{align*}
Note that the factor of $8$ comes from the following fact. When we integrate over $n$, we are integrating over all $n \in \mathbb R_{> 0}^3$. When we integrate over $k$, we are integrating over all $k \in \mathbb R^3$. Thus we must divide by $8$ to represent the fact that we are only interested in the all-positive octant.
In the second line, we are simply saying that $N$ is large enough that the sum can be approximated by the integral. In the third line, we change variables to $k_x = \pi n_x / L$, and similar for $y$ and $z$. In the fourth line, we use that $L^3$ is the volume of the box. In the fifth line, we change variables from $k_x \to p_x = \hbar k_x$, and similarly for $y,z$.
The $1/N!$ comes from the fact that we say particles are indistinguishable, but the way we've done the integral suggests that they are distinguishable (i.e. we've kept track of the $i^{\rm th}$ particle throughout). Since particles are indistinguishable, we divide by the total number of permutations of the $N$ particles, $N!$, to get the correct result.
A: The expression is correct as written, except I think you don't want to have your sum in the exponential since you already have a product over exponentials.
In general, once you sum over all possible states and turn that sum into an integral, you need to write it as
$\sum_i \approx \int D(u) d u$
where the number of points between $u, u + du$ is $D(u) du$, with generalization to numbers of points in hypercubes for vector-valued $u$.
So how do you get $D(\cdot)$? Clearly, it shouldn't be the same for $D(x_i, p_i)$ as for $D(\epsilon)$ (we shouldn't even be using the same symbol for them) since those don't have the same units. In the first case, it turns out that one position or momentum is as good as another, so we can just pick our constant density of states in phase space to be $D(x_i, p_i) = h^{-3N}$ so the units work out right. In the second case we'd actually have to work out the energy density of states. But when we integrate over phase space variables there's no need to put the density of states in energy space.
A: The density-of-states appears when we pass from the integral over the phase space to the one over the energy:
$$
Z=\frac{1}{N!h^{3N}}\int \left(\prod_{i=1}^N d^3x_id^3p_i\right)e^{-\beta\sum_{i=1}^N\frac{p_i^2}{2m}} =\\
\frac{1}{N!h^{3N}}\int dE\int\left(\prod_{i=1}^N d^3x_id^3p_i\right)\delta\left(E-\sum_{i=1}^N\frac{p_i^2}{2m}\right)e^{-\beta E}=\\
\frac{1}{N!h^{3N}}\int dED(E)e^{-\beta E}=
\frac{1}{N!h^{3N}}\int dEe^{-\beta [E-T\log D(E)]}=
\frac{1}{N!h^{3N}}\int dEe^{-\beta [E-TS(E)]}
$$
where the density-of-states is
$$
D(E)=\int\left(\prod_{i=1}^N d^3x_id^3p_i\right)\delta\left(E-\sum_{i=1}^N\frac{p_i^2}{2m}\right),
$$
and the entropy is defined as
$$
S(E)=\log D(E)
$$
Remark: one further evaluates this integral using the method of steepest descent and identifying that minimum free energy, $F$ as
$$
e^{-\beta F} = e^{-\beta[E^*-TS(E^*)]}
$$
