mechanical statistics - computaion of partition function Let us consider an ideal gas of $N$ particles contained in the volume $V$ with unitary spin $\vec S$. In particular, the z-component of the spin is $S^z = -1,0,1$. In an external magnetic field $\vec B = B \hat z$ the Hamiltonian writes as
$$ H= \sum_{i=1}^N \frac{\vec p_i}{2m}-hS_i ^z$$
where $p_i$ are the momenta and $h := \mu_B B$.
Using the canonical ensemble at temperature $T$, compute:


*

*the partition function $Z$

*mean energy $\langle E \rangle$

*mean magnetization $\langle M \rangle$, where $M = \mu  \sum_i S_i ^z$

*susceptibility $\chi=\frac{\partial M}{\partial h} |_{h=0}$

*entropy $S$
Questions 2, 4, and 5 are not a problem once I know $Z$ and $M$.
The problem is in fact the computation of these two functions.
For the first one I tried to apply the definition
$$Z=\int \frac{1}{h^{3N} N!} e^{-\beta H}dp dq= \int \frac{1}{h^{3N} N!} e^{-\beta \frac{\vec p^2}{2m}}dp dq$$
and then compute the integrals using spherical coordinates for the $dp$ part and $V$ for $dq$.
For $M$ I tried to invert the Hamiltonian considering that $H=E$. But now how do I go on?
What do you think about my resolution? What should I change and how can I continue?
 A: For the partition function, remember that you have to sum/integrate over all microstates: all combinations of particle positions, momenta, and spins. Hence, your partition function should include integrals over $p$ and $q$ as well as sums over $S$.
For a single particle, the partition function should therefore be:
$$Z_1 = \sum_{S=-1,0,1}\int \frac{1}{h^{3}} e^{-\beta H(p,q,S)}dp dq.$$
When filling in the Hamiltonian, remember to include the spin term; you seem to have left it out in your expression for $Z$.
Fortunately, the integrals and sums are independent, and hence can be separated.
The integral over $q$ is taken over the volume $V$, and trivially gives you a factor $V$ since the integrand does not depend on $q$.
The integral over $p$ is taken over all of momentum space, and gives you a (solvable) Gaussian integral.
The sum simply gives you three terms: $\exp(\beta\mu_B B) + \exp(0) + \exp(-\beta\mu_B B)$.
For the full partition function $Z$, we have to sum and integrate over the momenta, coordinates, and spins of all particles. However, since these are all independent for an ideal gas, the full partition function is just $Z = (Z_1)^N / N!$.
Expectation values $\langle A \rangle$ for a single-particle property $A$ can then be calculated by again integrating over all states:
$$\langle A \rangle = \frac{1}{Z_1} \sum_{S=-1,0,1}\int A(p,q,S) \frac{1}{h^{3}} e^{-\beta H(p,q,S)}dp dq.$$
Alternatively, you can look into how expectation values for thermodynamic quantities, such as the energy, are related to partial derivatives of the partition function (or of the free energy).
