Solution (source code)

= Solution

A <canonical ensemble> describes a system with fixed particle number and external parameters that exchanges energy with a heat bath at fixed <temperature> $T$. With $\beta=(k_BT)^{-1}$,
$$
\boxed{Z(\beta)=\sum_{i=0}^\infty e^{-\beta E_i},
\qquad p_i=\frac{e^{-\beta E_i}}Z.}
$$