# Gas in a harmonic trap

The results of the quantum harmonic oscillator can be used to look at the equilibrium situation for a quantum ideal gas in a harmonic trap, which is a harmonic potential containing a large number of particles that do not interact with each other except for instantaneous thermalizing collisions. This situation is of great practical importance since many experimental studies of Bose gases are conducted in such harmonic traps.
Using the results from either Maxwell–Boltzmann statistics, Bose–Einstein statistics or Fermi–Dirac statistics we use the Thomas–Fermi approximation (gas in a box) and go to the limit of a very large trap, and express the degeneracy of the energy states ($g_{i}$) as a differential, and summations over states as integrals. We will then be in a position to calculate the thermodynamic properties of the gas using the partition function or the grand partition function. Only the case of massive particles will be considered, although the results can be extended to massless particles as well, much as was done in the case of the ideal gas in a box. More complete calculations will be left to separate articles, but some simple examples will be given in this article.

## Thomas–Fermi approximation for the degeneracy of states

For massive particles in a harmonic well, the states of the particle are enumerated by a set of quantum numbers $[n_{x},n_{y},n_{z}]$. The energy of a particular state is given by:
    $E=\hbar \omega \left(n_{x}+n_{y}+n_{z}+3/2\right)~~~~~~~~n_{i}=0,1,2,\ldots$
Suppose each set of quantum numbers specify $f$ states where $f$ is the number of internal degrees of freedom of the particle that can be altered by collision. For example, a spin-1/2 particle would have $f=2$, one for each spin state. We can think of each possible state of a particle as a point on a 3-dimensional grid of positive integers. The Thomas–Fermi approximation assumes that the quantum numbers are so large that they may be considered to be a continuum. For large values of $n$, we can estimate the number of states with energy less than or equal to $E$ from the above equation as:
    $g=f\,{\frac {n^{3}}{6}}=f\,{\frac {(E/\hbar \omega )^{3}}{6}}$
which is just $f$ times the volume of the tetrahedron formed by the plane described by the energy equation and the bounding planes of the positive octant. The number of states with energy between $E$ and $E+dE$ is therefore:
    $dg={\frac {1}{2}}\,fn^{2}\,dn={\frac {f}{(\hbar \omega \beta )^{3}}}~{\frac {1}{2}}~\beta ^{3}E^{2}\,dE$
Notice that in using this continuum approximation, we have lost the ability to characterize the low-energy states, including the ground state where $n_{i}=0$. For most cases this will not be a problem, but when considering Bose–Einstein condensation, in which a large portion of the gas is in or near the ground state, we will need to recover the ability to deal with low energy states.
Without using the continuum approximation, the number of particles with energy $\epsilon _{i}$ is given by:
    $N_{i}={\frac {g_{i}}{\Phi }}$
where
    $\Phi =e^{\beta (\epsilon _{i}-\mu )}$  for particles obeying Maxwell–Boltzmann statistics $\Phi =e^{\beta (\epsilon _{i}-\mu )}-1$  for particles obeying Bose–Einstein statistics $\Phi =e^{\beta (\epsilon _{i}-\mu )}+1$  for particles obeying Fermi–Dirac statistics
with $\beta =1/kT$, with $k$ being the Boltzmann constant, $T$ being temperature, and $\mu$ being the chemical potential. Using the continuum approximation, the number of particles $dN$ with energy between $E$ and $E+dE$ is now written:
    $dN={\frac {dg}{\Phi }}$

## Energy distribution function

We are now in a position to determine some distribution functions for the "gas in a harmonic trap." The distribution function for any variable $A$ is $P_{A}dA$ and is equal to the fraction of particles which have values for $A$ between $A$ and $A+dA$:
    $P_{A}~dA={\frac {dN}{N}}={\frac {dg}{N\Phi }}$
It follows that:
    $\int _{A}P_{A}~dA=1$
Using these relationships we obtain the energy distribution function:
    $P_{E}~dE={\frac {1}{N}}\,\left({\frac {f}{(\hbar \omega \beta )^{3}}}\right)~{\frac {1}{2}}{\frac {\beta ^{3}E^{2}}{\Phi }}\,dE$

## Specific examples

The following sections give an example of results for some specific cases.

### Massive Maxwell–Boltzmann particles

For this case:
    $\Phi =e^{\beta (E-\mu )}$
Integrating the energy distribution function and solving for $N$ gives:
    $N={\frac {f}{(\hbar \omega \beta )^{3}}}~e^{\beta \mu }$
Substituting into the original energy distribution function gives:
    $P_{E}~dE={\frac {\beta ^{3}E^{2}e^{-\beta E}}{2}}\,dE$

### Massive Bose–Einstein particles

For this case:
    $\Phi =e^{\beta \epsilon }/z-1$
where $z$ is defined as:
    $z=e^{\beta \mu }$
Integrating the energy distribution function and solving for $N$ gives:
    $N={\frac {f}{(\hbar \omega \beta )^{3}}}~\mathrm {Li} _{3}(z),$
where $\mathrm {Li} _{s}(z)$ is the polylogarithm function. The polylogarithm term must always be positive and real, which means its value will go from 0 to $\zeta (3)$ as $z$ goes from 0 to 1. As the temperature goes to zero, $\beta$ will become larger and larger, until finally $\beta$ will reach a critical value $\beta _{\text{c}}$, where $z=1$ and
    $N={\frac {f}{(\hbar \omega \beta _{c})^{3}}}~\zeta (3).$
The temperature at which $\beta =\beta _{c}$ is the critical temperature at which a Bose–Einstein condensate begins to form. The problem is, as mentioned above, the ground state has been ignored in the continuum approximation. It turns out that the above expression expresses the number of bosons in excited states rather well, and so we may write:
    $N={\frac {g_{0}z}{1-z}}+{\frac {f}{(\hbar \omega \beta )^{3}}}~\mathrm {Li} _{3}(z)$
where the added term is the number of particles in the ground state. (The ground state energy has been ignored.) This equation will hold down to zero temperature. Further results can be found in the article on the ideal Bose gas.

### Massive Fermi–Dirac particles (e.g. electrons in a metal)

For this case:
    $\Phi =e^{\beta (E-\mu )}+1$
Integrating the energy distribution function gives:
    $1={\frac {f}{(\hbar \omega \beta )^{3}}}~\left[-\mathrm {Li} _{3}(-z)\right]$
where again, $\mathrm {Li} _{s}(z)$ is the polylogarithm function. Further results can be found in the article on the ideal Fermi gas.