Let us consider the more realistic case in which our system is in thermal contact with the environment, allowing energy to be exchanged in the form of heat. This situation corresponds to a system in a heat reservoir or heat bath. Now consider that the total energy of the environment and the system is fixed and constant, but the energy of the system can vary. Imagine a large number of copies of the composite system+reservoir, and we consider that this composite supersystem is isolated and can be described by the microcanonical ensemble. However, since we are only interested in the physical properties of the system without the reservoir, we need to know the probability of finding the laboratory system in the state with energy . The ensemble which describes the probability distribution of a system in thermal equilibrium with a heat bath is known as the ``canonical ensemble''.
An example of such a system is our demon, immersed in the heat bath of the other particles. The microstate of the demon is defined by its energy .
Our strategy for finding the form of the probability distribution of the
canonical ensemble is to do a computer simulation of a demon which can
exchange energy with an ideal gas of particles. The ideal gas will
serve as the heat bath and we will determine the probability that
the demon has energy . The exact form of this probability
distribution is given by
Note that the Boltzmann distribution is specified by the temperature. If we assume that the form (113) is applicable to any system in thermal equilibrium with a heat bath, we see that the macrostate in the canonical ensemble is specified by , and . In contrast, a macrostate in the microcanonical ensemble is specified by , and .
The form (113) of the Boltzmann distribution provides a
simple way of computing from the mean energy
of
the demon. Since
is given by