  We introduce and study a model of a logarithmic gas with inverse temperature
$\beta$ on an arbitrary smooth closed contour in the plane. This model
generalizes Dyson's gas (the $\beta$-ensemble) on the unit circle. We compute
the non-vanishing terms of the large $N$ expansion of the free energy ($N$ is
the number of particles) by iterating the "loop equation" that is the Ward
identity with respect to reparametrizations and dilatation of the contour. We
show that the main contribution to the free energy is expressed through the
spectral determinant of the Neumann jump operator associated with the contour,
or equivalently through the Fredholm determinant of the Neumann-Poincare
(double layer) operator. This result connects the statistical mechanics of the
Dyson gas to the spectral geometry of the interior and exterior domains of the
supporting contour.
