In physics, a partition function describes the statistical properties of a system in thermodynamic equilibrium. Partition functions are functions of the thermodynamic state variables, such as the temperature and volume. Most of the aggregate thermodynamic variables of the system, such as the total energy, free energy, entropy, and pressure, can be expressed in terms of the partition function or its derivatives. The partition function is dimensionless. Each partition function is constructed to represent a particular statistical ensemble (which, in turn, corresponds to a particular free energy). The most common statistical ensembles have named partition functions. The canonical partition function applies to a canonical ensemble, in which the system is allowed to exchange heat with the environment at fixed temperature, volume, and number of particles. The grand canonical partition function applies to a grand canonical ensemble, in which the system can exchange both heat and particles with the environment, at fixed temperature, volume, and chemical potential. Other types of partition functions can be defined for different circumstances; see partition function (mathematics) for generalizations. The partition function has many physical meanings, as discussed in Meaning and significance.
Canonical partition function
Definition Initially, let us assume that a thermodynamically large system is in thermal contact with the environment, with a temperature T, and both the volume of the system and the number of constituent particles are fixed. A collection of this kind of system comprises an ensemble called a canonical ensemble. The appropriate mathematical expression for the canonical partition function depends on the degrees of freedom of the system, whether the context is classical mechanics or quantum mechanics, and whether the spectrum of states is discrete or continuous.
Classical discrete system For a canonical ensemble that is classical and discrete, the canonical partition function is defined as Z=∑ie−βEi, where
i is the index for the microstates of the system; e is Euler's number; β is the thermodynamic beta, defined as 1kBT where kB is the Boltzmann constant; Ei is the total energy of the system in the respective microstate. The exponential factor e−βEi is otherwise known as the Boltzmann factor.
Classical continuous system In classical mechanics, the position and momentum variables of a particle can vary continuously, so the set of microstates is actually uncountable. In classical statistical mechanics, it is rather inaccurate to express the partition function as a sum of discrete terms. In this case we must describe the partition function using an integral rather than a sum. For a canonical ensemble that is classical and continuous, the canonical partition function is defined as Z=1h3∫e−βH(q,p)d3qd3p, where
h is the Planck constant; β is the thermodynamic beta, defined as 1kBT; H(q,p) is the Hamiltonian of the system; q is the canonical position; p is the canonical momentum. To make it into a dimensionless quantity, we must divide it by h, which is some quantity with units of action (usually taken to be the Planck constant). For generalized cases, the partition function of N particles in d-dimensions is given by Z=1hNd∫∏i=1Ne−βℋ(𝐪i,𝐩i)dd𝐪idd𝐩i,
Classical continuous system (multiple identical particles) For a gas of N identical classical non-interacting particles in three dimensions, the partition function is Z=1N!h3N∫exp(−β∑i=1NH(𝐪i,𝐩i))d3q1⋯d3qNd3p1⋯d3pN=ZsingleNN! where
h is the Planck constant; β is the thermodynamic beta, defined as 1kBT; i is the index for the particles of the system; H is the Hamiltonian of a respective particle; qi is the canonical position of the respective particle; pi is the canonical momentum of the respective particle; d3 is shorthand notation to indicate that qi and pi are vectors in three-dimensional space. Zsingle is the classical continuous partition function of a single particle as given in the previous section. The reason for the factorial factor N! is discussed below. The extra constant factor introduced in the denominator was introduced because, unlike the discrete form, the continuous form shown above is not dimensionless. As stated in the previous section, to make it into a dimensionless quantity, we must divide it by h3N (where h is usually taken to be the Planck constant).
Quantum mechanical discrete system For a canonical ensemble that is quantum mechanical and discrete, the canonical partition function is defined as the trace of the Boltzmann factor: Z=tr(e−βĤ), where:
tr(∘) is the trace of a matrix; β is the thermodynamic beta, defined as 1kBT; Ĥ is the Hamiltonian operator. The dimension of e−βĤ is the number of energy eigenstates of the system.
Quantum mechanical continuous system For a canonical ensemble that is quantum mechanical and continuous, the canonical partition function is defined as Z=1h∫⟨q,p|e−βĤ|q,p⟩dqdp, where:
… excerpt ends here. Continue reading the full article.


