Statistical mechanics considers any system to be statistically distributed across an ensemble of N microstates. In a system that is in thermodynamic contact equilibrium with a heat reservoir, each microstate has an energy E i and is associated with a probability p i . The internal energy is the mean value of the system's total energy, i.e., the sum of all microstate energies, each weighted by its probability of occurrence: