These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
Statistical Mechanics in Einstein solids and Systems in Contact
-
#### Introduction
In this activity, you will build a statistical model of two interacting "Einstein" solids (let's call them "solid A" and "solid B") and show that this system has many of the same qualitative attributes that we associate with **thermodynamic equilibrium** and furthermore that the **statistical multiplicity** has many of the same attributes that we normally associate with **classical entropy**.
The Einstein model of a Solid is an extension of the "ball-and-spring model" of a solid in which atoms are represented as spheres with spring-like chemical bonds holding them together in the x, y, and z directions:
https://www.glowscript.org/#/user/matterandinteractions/folder/matterandinteractions/program/04-ball-and-spring-model
The Einstein model further specifies that the energy content of the ball-and-spring model is quantized.
https://www.glowscript.org/#/user/matterandinteractions/folder/matterandinteractions/program/12-wells-oscillator
You are encouraged to use your two-state computational model as a framework to model this this new system, but you shouldn't have much difficulty building this model from scratch. Ultimately, your program should output a plot of the number of **microstates** for each possible **macro-state** The broad structure for your program should be:
* Define a set of **macro-states**; Imagine starting with all of the quanta in solid A and then one-by-one shifting individual quanta into solid B.
* Calculate the multiplicity associated with a single macrostate
* Iterate this calculation over each macrostate, and
* Output and plot the results.
This model differs from the 2-state system in a few key ways:
* The combinatoric formula for Einstein solids is different than the formula for a 2-state system
* You’ll have to compute the combined multiplicity for two objects instead of for just one
* You’ll have to make use of either
1. an iterative loop or
2. more sophisticated techniques like vectorization (including using methods); your choice!
Once complete, your model can serve as a plausibility argument for the statistical picture by reproducing some of the qualitative features we observe from classical thermodynamics. In the following activity, you will use your model to generate *testable* predictions of heat capacity.
Exercise 1: A test case
-
Let’s first consider a test case that we can easily solve with pen-and-paper against which we can compare our computational solution---**two [1-atom Einstein solids](https://www.glowscript.org/#/user/matterandinteractions/folder/matterandinteractions/program/12-wells-oscillator) solids (let's call them "A" and "B") that are in contact and sharing 8 quanta of energy**. This is, of course, an artificial example but once we are able to use the computer to recreate this result, we can expand that algorithm to other more physically meaningful situations.
**Answer the following questions**
1. Explicitly list all possible ways that these atoms can share 8 quanta of energy (e.g. solid A has 3 quanta and solid B has 5...). These are the system's **macrostates**.
2. How many oscillators does each solid have?
Recall the combinatoric formula for an Einstein solid:
$$
\Omega(N,q) = \dfrac{(q + N-1)!}{(N-1)!q!},
$$
where $N$ is the number of oscillators in the solid and $q$ is the number of energy quanta.
3. For each division of energy you listed above, calculate
* the number of ways that an amount of energy, $q_A$ can be in solid A,
* the number of ways that an amount of energy $(q_\text{total} - q_A)$ can be in solid B, and
* The combined number of microstates for each division of energy.
4. What is the total combined number of micro states? (*Hint: there are two ways to find this*)
As in the case of a 2-state system, we can appeal to the **fundamental assumption of statistical mechanics**: *all microstates are equally likely to occur.* This applies equally to microstates within the same macrostate and to microstates in different macrostates!
5. What are the odds that you would find 3 quanta of energy in atom A and 5 quanta in atom B?
Exercise 2: Setting up the program
-
If you are reusing old code, "[2-state systems: the story of the Purple pandas](https://www.compadre.org/PICUP/exercises/Exercise.cfm?I=276)" is a good place to start. Otherwise, be sure to load appropriate libraries in order to perform combinatorics, generate graphs, and manipulate arrays of numbers.
**Plan out your program writing pseudo-code for what you want it to do.** (This is somewhat like programming’s version of creating an outline; focus on the structure of the program and not on syntactic details). Feel free to look back at the top of this exercise set or look ahead at the next section, but you should focus on 3 related questions:
* What variables will you need to use in your program and what kind of programming objects are they (e.g., integers, lists, arrays, etc.).
* How will these objects be constructed within the program? (will they be user-defined? will they need to be iteratively build within the program?)
* How will these objects be used later in the program? Will any of them need to be updated in an iterative loop? Will you be performing math on them? Will any of these objects need to be used to build another?
Go ahead and create a ``#parameters`` section in your program and set values for ``N_A``, ``N_B`` and ``q_total`` according to the test model above (two 1-atom Einstein solids sharing 8 quanta of energy between them).
Exercise 3: Building the Model
--
We would like to calculate the multiplicity of the combined system as a function of the number of quanta in solid A.
**Write an algorithm that will do the following**:
* Generate a list (or array) of every possible value of $q_\text{A}$. This will represent your **macrostates**. (How many elements should be in this list/array?)
* Do the same for every value of $q_\text{B}$ (don't forget that $q_\text{B} = q_\text{total} - q_\text{A}$).
* Calculate the multiplicity of microstates in solid A for *each* value of $q_\text{A}$. Do this again for solid B. Both of these should be in the form of a list or array.
* Calculate the combined multiplicity for each distribution of energy. Your algorithm should output this as a list/array
**Before moving on, make sure that the output of your code is consistent with your calculations in Exercise 1**
**Create a bar plot of the combined multiplicity, $\Omega_\text{combined}$, vs. $q_A$**
This is a good opportunity to check the documentation of your particular programming language. Keep in mind that you should be generating a **bar plot** which plots two lists against each other and **not** a histogram which sorts and bins a single list. Ask your instructor if you need help with this.
**Answer the following questions**
6. Briefly describe (to the best of your understanding) some of the qualities of **macroscopic thermal equilibrium**.
7. The macrostate $(q_\text{A} = 4,q_\text{B} = 4)$ has two interesting qualities:
* Energy is equally split between the two solids and
* Compared with the other macrostates, this macrostate has the largest number of corresponding micro-states (i.e. the largest multiplicity)
Argue for why we should expect each of these statistical descriptions to plausibly correspond to our understanding of macroscopic thermodynamic equilibrium. Are there any aspects of macroscopic thermal equilibrium that is *not* captured by these two qualities?
Exercise 4: Adapting your model
-
Once you are able to reproduce the results you calculated algebraically, you should be able to easily alter your program to model other situations.
**Adapt your code to do the following:**
* Model two Einstein solids in contact; one with 30 oscillators and one with 50, sharing 80 quanta between them.
* Insert code print out the macrostate (or value of $q_\text{A}$) that has the highest multiplicity. Also print out this multiplicity.
* Insert code to print out the total number of microstates.
**Answer the following questions**
8. In this new situation, the macrostate with the highest multiplicity no longer features a 50-50 division of energy between the two solids; To what does new division of energy seem to correspond? Explain whether or not it still makes sense to associate this uneven division of energy with macroscopic equilibrium. Can you use this to come up with a plausible description for what "statistical equilibrium" is in terms of energy distributions?
9. You might have balked at the artificiality of modeling single atoms as solids and, even worse, modeling those single atoms as if they can oscillate against neighboring atoms. But even the $N=30$ and $N=50$ solids from Exercise 3 have the problem that a large fraction of the atoms are edge-cases that are missing some neighboring bonds.
Argue for why, in the limit of macroscopic materials ($N\approx 10^{23}$), these edge-cases produce a negligible discrepancy from the overall behavior predicted by the Einstein-Solid model and that the combinatoric function is appropriate to use in this limit. Can you brainstorm other limitations of this model that we might want to take into account in more sophisticated models?
10. The plot from your original model ($N_A = N_B = 3$; $q_\text{total} = 8$) was fairly broad, suggesting the possibility of large fluctuations about the maximal value; Recreate that plot and estimate the standard deviation as a fraction of the whole. One way to do this is to estimate the half-width at half the maximum height as a fraction of the total range but you can also calculate the standard deviation with a bit of extra code making use of the definitions at the bottom of this section.
Qualitatively, what effect does increasing the values of $q_\text{total}$, $N_A$, and $N_B$ have on the standard deviation as a percent of the total range? What impact do you think that this has on fluctuations about the maximal value? What do you think would happen to the spread and to the system's fluctuations if $N_A$, $N_B$, and $q_\text{total}$ were on the order of $10^{23}$ (but don't actually put these large numbers into your program)? What do you think this says about the odds of finding a system far from equilibrium?
$$
\begin{align}
\text{stdev}(q) &= \sqrt{\langle q^2\rangle - \langle q\rangle^2}\\
\langle q\rangle &= \sum_{q=0}^{q_\text{total}}q\Omega_\text{combined}\\
\langle q^2\rangle &= \sum_{q=0}^{q_\text{total}}q^2\Omega_\text{combined}
\end{align}
$$
Exercise 5: Statistical Entropy
--
**Create a plot of ln($\Omega$) vs. $q_A$**
It is sometimes useful to plot these curves (the multiplicity of A, the multiplicity of B, and the combined multiplicity) together on a semilogarithmic plot. Adjust your model to do this.
This is the **Entropy**, defined as $S = k_B\ln\Omega$.
**Answer the following questions**
11. What is the significance of where the combined graph ($\ln \Omega_A +\ln \Omega_B$) reaches its peak? How does the slope of the other two plots ($\ln \Omega_A$ and $\ln \Omega_B$) compare to each other at this point?
12. Consider one of the extreme macrostates---say $(q_A = q_\text{total}, q_B = 0)$; Conceptually, which block would you expect to be hotter? How would you compare the inverses of the individual $\ln \Omega$ slopes ($\partial q/\partial \ln(\Omega)$) in this state? Identify some of the ways taht the inverses slopes behave in the same way as macroscopic temperature and argue for why it seems reasonable to associate temperature with this inverse slope.
13. Think of some properties that **classical entropy** has---especially with regards to thermodynamic equilibrium---and argue for why it seems reasonable to associate the classical entropy with this statistical measure $\left(\ln \Omega_A +\ln \Omega_B\right)$. (**Statistical entropy** is defined as $k_\text{B}\ln \Omega$; go ahead and adjust your plot accordingly.)
14. What is the meaning of the point where the plots of $\ln \Omega_A$ and $\ln \Omega_B$ cross? Does this have any physical significance?