## Demon Einstein Solid

Program `DemonEinsteinSolid` models an ideal thermometer, called the *demon*. The demon is in thermal equilibrium
with a system of $N$ oscillators called an Einstein solid. The energy of each oscillator is restricted to an integer and is $\geq 0$. The energy of the demon is its only property, and thus the
energy of the demon is a label for a microstate of the demon.

The demon randomly visits an oscillator and randomly attempts to increase or decrease its energy by $\pm 1$. If the change decreases the energy, the change is accepted and the lost energy goes to the demon. If the change increases the energy, this change is accepted only if the demon has enough energy to give to cover the increase in the energy of the system. (The energy of each oscillator must be nonnegative.)

The goal of this simulation is to explore how the demon's mean energy and probability distribution are related to the temperature and to determine the temperature dependence of the energy for an Einstein solid. The key idea is that the demon acts as a system in thermal equilibrium with a reservoir of Einstein oscillators, and thus the energy distribution of the demon follows a Boltzmann distribution.

**Problem: The demon and the Einstein solid**

Consider a demon that exchanges energy with an Einstein solid of
$N$ particles. The demon selects a particle at random and randomly changes its energy
by $\pm 1$ consistent with the constraint that $E_{d}
\geq 0$. In this case the energy of a particle in the system also must
remain nonnegative. Why?
Use Program `DemonEinsteinSolid` to do the simulations.

- Choose $N=40$ and various value of $E \geq 200$. What is the mean energy of the demon after equilibrium between the demon and the system has been established? Plot $\overline{E}/N$ versus $\overline{E_{d}}$. Is the value of $\overline{E}/N$ proportional to $\overline{E_{d}}$ as it is for an ideal gas?
- Compute the probability $P(E_{\rm d})$ for various values of $E$ and $N$ and determine $-\beta$, the slope of $\ln P(E_{\rm d})$. How is $1/\beta$ related to $\overline{E_d}$?
- Why is the slope of $\ln{P(E_d)}$ independent of $E/N$?
- Suppose that the demon can transfer energy to and from the system easily so that most of its trial changes are accepted. What can you conclude about the slope of $\ln{P(E_d)}$ versus $E_d$ in this case? Is the temperature high or low? What can you conclude about the slope if the temperature is such that few trial changes are accepted?
- Explain why the demon's mean energy is given by \begin{equation} \label{eq:4/edbar} \overline{E_{d}} = \frac{\sum_{n=0}^\infty n e^{-\beta n} }{\sum_{n=0}^\infty e^{-\beta n}}. \end{equation} Why is the energy of the demon restricted to integer values?
- Do the sums in (\ref{eq:4/edbar}) to determine the temperature dependence of $\overline{E_{d}}$. It is only necessary to directly evaluate the sum in the denominator of \eqref{eq:4/edbar}. The numerator can be determined by an appropriate derivative of the result for the denominator.
- Why is the temperature dependence of $\overline{E_{d}}$ different for an ideal gas and an Einstein solid?

## Resources

- The program on this page was converted from Java to JavaScript by Wolfgang Christian and Robert Hanson using the SwingJS system developed at St. Olaf College.
- Download source code for all java programs. Requires OSP library to run.
- Download all python programs.
- Download executable jar file for all programs (need to install Java on your computer to run jar files.)
- Problem 4.31 in
*Statistical and Thermal Physics: With Computer Applications*, 2nd ed., Harvey Gould and Jan Tobochnik, Princeton University Press (2021).