Consider a simple system known as the Einstein or harmonic solid. The energy of each particle in an Einstein solid is restricted to the positive integers. That is, each particle may have energy 0, 1, 2, … The particles do not interact.
One advantage of the Einstein solid is that it is easy to calculate the number of microstates Ω(E,N) for a given number of particles N and energy E.
Consider two Einstein solids A and B that allow particles to move from one solid to the other, but not energy. That is, the two systems are surrounded by insulating, rigid, and impermeable outer walls and are separated from each other by a wall that allows particles to move through it, but no energy. This constraint is unphysical, but it will be useful conceptually for understanding the chemical potential. The program counts the number of ways that the particles can be distributed between the two systems. NA is the number of oscillators in system A and NB is the number in system B.
The total number of microstates Ω(EA,EA) accessible to the composite system with subsystems A and N with fixed energy EA and EB and number of particles NA and NB is
Ω(EA, EB) = ΩA(EA)ΩB(EB).
Because the composite system is isolated, its accessible microstates are equally probable. Hence, the probability PA(NA) that subsystem A has particle number NA is
PA(NA) = ΩA(NA)ΩB(N - NA)/Ω.
The output of the program is a plot of PA(NA) and the corresponding table of data.
Updated 14 April 2010.