This Exercise Set has been submitted for peer review, but it has not yet been accepted for publication in the PICUP collection.
Boltzmann distribution, the statistical way
Developed by Jay Wang
The Boltzmann distribution is fundamental to statistical thermodynamics [1,2]. It states that the probability of a thermal system in an energy state $E_n$ at temperature $T$ is
$$P_n=C \exp(E_n/kT), \label{boltz}$$
where $C$ is a normalization constant. Through simulations of thermal interactions in an Einstein solid, the student will demonstrate and discover that the Boltzmann distribution is simply a result of overwhelming probability toward equilibrium, and gain a deeper understanding of the connection to entropy.
Subject Area  Thermal & Statistical Physics 

Levels  First Year and Beyond the First Year 
Learning Objectives 
Students who complete these exercises will be able to:
 discuss thermal equilibrium in a thought experiment among peers and make predictions (**Exercise 1**)
 simulate equilibrium process through thermal interactions in an Einstein solid, and verify the predictions (**Exercise 2**)
 demonstrate that the Boltzmann distribution is a result of overwhelming probability toward equilibrium; compare numerical and analytic results and assess errors including statistical error (**Exercise 3**)
 extend the simulation to study related properties and gain insight including the connection between equilibrium, Boltzmann distribution, and entropy (**Exercise 4**)
 present simulation results in graphical format including animation; add and modify objectoriented class (**Exercises 24**)

Time to Complete  180 min 
## Exercise 1: Predicting thermal equilibrium
In a thermal system, we have many atoms and molecules exchanging energy with each other via mutual interactions in order to reach equilibrium. To mimic such a system, let us play a thought moneyswap game among $N$ people in the room. Everyone starts with 10 gold coins. The rules are: In each turn, we randomly select a person (say Amy) to give a coin to another randomlyselected person (say Bob). If Amy has coins in her possession, she gives one to Bob. If Amy has no coins, do nothing. Repeat the turns many times. What is the wealth distribution (number of coins each person has) in the end?
 A: equally distributed (everyone has roughly the same average 10 coins)
 B: richpoor divide (a few rich people but many poor ones)
 C: bellshaped curve (most people in the middle)
 D: not sure (random outcome)
Make a prediction, and write it down.
##Exercise 2: Exploring route to equilibrium
Run the simulation with the provided program in the animation mode. Note each grid point represents the amount of energy in that oscillator. Describe the change in the distribution from the animation. Does your prediction agree with the simulation? Why does a randomselection rule not produce a uniform distribution? (hypothesis and speculations encouraged)
##Exercise 3: Analyzing the Boltzmann distribution
Again run the simulation, this time without animation (set `animate=False` if using `boltzmann.py`), producing a plot of the distribution as a function of energy. Note the data points scatter around a straight line of the analytic result Eq. (\ref{boltz}) on a semilog scale for the $y$axis.
 From the graph, estimate the slope of the line. What is the meaning of it?
 Modify the program to change the solid size $N$ to `30x30`, `40x40`, and average energy $\bar q$ to `20`, `30`, etc. Each time obtain the slope graphically, and compare them with Eq. (\ref{teps}). What does the slope depend on, $N$, $\bar q$, or both? Explain.
 Focusing on the data error bars, what makes them smaller, $N$ or $\bar q$? Test your hypothesis by changing $N$ and $\bar q$ as above.
##Exercise 4: Relating the Boltzmann distribution and entropy
You have seen above that random interactions leads deterministically to the exponential Boltzmann distribution. Is this an accident? Is there something deeper? To answer these questions, carry out the following study.
 Compute the multiplicity $\Omega$ from Eq. (\ref{omg}) and the scaled entropy $S/k$ from Eq. (\ref{entropy}). Plot $S/k$ for $N=400$ and $Q=0$ to 500.
 Add a method to the `EinsteinSolid` class to calculate scaled entropy $S/k$ from Eq. (\ref{spn}), call it `entropy`. Check that the method works correctly.
 Now modify the latter part of the program (plotting part, see template `iterate.py`) to calculate the energy distribution and entropy (using the `entropy` method) as a function of iterations (i.e., time). Plot both the distribution and the entropy. Describe how the energy distributions converge to the Boltzmann distribution. Simultaneously, observe how the entropy approaches the maximum in equilibrium.
 Based on above observations, how does the maximum entropy compare with the results computed above? What conclusions can you draw from the fact about entropy reaching maximum and, simultaneously, the energy distribution reaching the Boltzmann distribution?
Download Options
Credits and Licensing
The instructor materials are ©2017 Jay Wang.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license