0% found this document useful (0 votes)
13 views

Comp Assignment 1

This document outlines an assignment on statistical physics involving computational problems related to Einstein solids and casino games of chance. It includes 9 problems analyzing energy distributions, multiplicities, and probabilities using Python. Students are asked to model systems, make plots, and explain results.

Uploaded by

Jorn Hoekstra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Comp Assignment 1

This document outlines an assignment on statistical physics involving computational problems related to Einstein solids and casino games of chance. It includes 9 problems analyzing energy distributions, multiplicities, and probabilities using Python. Students are asked to model systems, make plots, and explain results.

Uploaded by

Jorn Hoekstra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

STATISTICAL PHYSICS: COMPUTATIONAL ASSIGNMENT I

D UE DATE
This assignment is due Sunday, May 14, 23:59.

H ANDING IN THE ASSIGNMENTS


Submission of the notebooks (1 per problem) is done on Brightspace (one submission per group!)
Your last submission counts. MAKE SURE THAT, E.G., ONE DAY BEFORE THE DEADLINE, YOUR
GROUP HAS ALREADY A NEAR-FINAL VERSION HANDED IN!!!
Wrap all notebook files into a single zip file. This file should be named using the net ID and
student NUMBER of the people in your group, as follows:
statfys_x_ID_NUMBER_ID_NUMBER.zip
where the x stands for the number of the session. A similar notation is to be used for groups con-
sisting of 1 or 3 students.

1. A SPECIAL E INSTEIN SOLID


We consider an Einstein solid having N oscillators. Special in this exercise is that each oscillator
can be in 6 states, the 1st state carrying 0 energy units, the 2nd and 3rd state carrying 1 energy unit,
and the 4th, 5th and 6th state carrying 2 energy units. The situation where multiple states carry the
same amount of energy is called degenerate. For simplicity, we take the energy unit to be 1 in this
exercise. All the oscillators together have an energy of q units.
(1) (8 points) The multiplicity tells us in how many ways this energy, q, can be distributed over
the N oscillators. Determine the minimum and maximum possible energy and their mul-
tiplicities. Instead of determining the multiplicities analytically, we will determine them
in a numerical manner by finding out all possible microstates and extract the energy from
the particular microstate. Provide a plot of the multiplicity versus the energy of the system.
Use N=8.
Hints: To loop over all the microstates you can use the itertools package (use import
itertools). In particular, you could use for microstate in itertools.product(range(6),
repeat=N): Use plt.semilogy for the plot.
Your notebook should include a plot of the multiplicity as a function of energy units with
properly labeled axes, a caption, and a title.
(2) (8 points) Now expand the calculation for N running from 2 to 8 oscillators, and compute
the multiplicity for each case. In a single figure, plot the multiplicities for each N against q
as in the previous part.
Your notebook should include a plot of the multiplicity as a function of the number of energy
units for each N with properly labeled axes and a legend. In addition, comment on how the
multiplicity changes with energy and the number of oscillators.
(3) (12 points) We now consider two Einstein solids that interact thermally with each other so
that they can exchange energy (in the form of heat). When we fix the energy in each system,
the total multiplicity is the product of the individual multiplicities of each solid. Let us
1
2 STATISTICAL PHYSICS: COMPUTATIONAL ASSIGNMENT I

consider two solids, with N1 = 8, N2 = 5 oscillators and together sharing q t ot = q 1 + q 2 = 16


total energy units. Plot the multiplicities of solid 1 and solid 2 using the semilogy function
(both as function of q 1 ). In the same figure, plot the total multiplicity, Ωt ot of the system
consisting of the two solids, by multiplying the individual multiplicities. Find the energy q 1
where the total multiplicity is maximum. Explain why the value obtained makes physical
sense.
Hint: Be careful to plot only the values of q that are physically allowed.
Your notebook should include a single plot with properly labeled axes, title, and legend with
three curves: one for the multiplicity of system 1 as a function of q 1 , one for the multiplicity
of 2 as a function of q 1 , and one for the total multiplicity as a function of q 1 . Identify the q 1
for which the total multiplicity is maximum.
(4) (2 points) Explain what happens if a third solid of the same type with N3 = 13 oscillators
and q 3 = 26 is brought into thermal contact with the other two solids? What is the expected
distribution of energy between the three solids? Your notebook contains an explanation.

2. T HE CASINO OF THE PEOPLE


A philantropist (a person giving away much of his/her money to charity) has started a casino.
The games played in this casino have better odds than usual for the customers. His version of
Roulette has only red or black numbers. The roulette disc is well-built and is therefore fair (equal
chance for red or black to occur). According to the equivalent theory in the book and lecture notes,
when we play N games on the N tables at the casino (consecutive games would give the same
odds), the multiplicity of drawing n times red is given by:
N!
µ ¶
N
Ω(N , n) = = . (1)
n n!(N − n)!
Stirling’s approximation for calculating a factorial is:
p
N ! ≈ 2πN N N e −N .
This is a slightly more accurate version than the more common Stirling approximation ln(N !) ≈
N [ln(N ) − 1]. The factorial function in Python can be used to calculate the value exactly.
(5) (10 Points) Calculate the multiplicity for a macrostate with n = 20 for different numbers of
roulette games N = 30, 31, ..., 100, using Eq. (1), calculating the factorials exactly by means
of the function factorial 1.
Then calculate again the multiplicity but now using Stirling’s approximation for the facto-
rials. Plot the percentage error of the multiplicity calculated using Stirling’s approximation.
Do not use for-loops, but array manipulations instead (which is much faster!).
Write functions for calculating the exact multiplicity and for the multiplicity using the Stir-
ling approximation.
In your notebook, plot the percentage error of the multiplicity obtained using Stirling’s ap-
proximation.
Hint: In order to calculate N N , use the numpy function np.float_power.
(6) (5 Points) State in your notebook from which number of roulette tables the error made by
using Stirling’s approximation becomes less than 0.5 %.
Hint: Python (NumPy): np.where(x<a) gives indices of elements of x less than a.

1python: scipy.special.factorial
STATISTICAL PHYSICS: COMPUTATIONAL ASSIGNMENT I 3

In your notebook, give the number of roulette tables N above which the error satisfies the
0.5 % criterion.
(7) (10 Points) Customers are complaining that red seems to appear more often than black.
The casino performs an investigation. Suppose the probability for obtaining red on any
table is P r (for black therefore it is 1 − P r ). Find a formula for the probability of getting n
times red on N roulette tables.
The staff has performed many experiments with the roulete tables and find that the most
probable number of reds when running 50 roulette tables is 30. With this information, find
P r (simply experiment with different values of P r , there is not a unique answer).
Plot the probability of getting n = 0, 1, 2, ..., 50 reds for this case together with a plot for
the case where the roulette tables are fair (equal probability for red and black).
In your notebook, give the formula for the probability of having n reds. Give the value of P r .
Plot the probabilities against the number of reds, for fair and for unfair tables.

3. W EATHER BALLOON
Consider a Helium filled weather balloon that is released at sea level and rises with a fixed ve-
locity of 30 m/s. We will consider the Helium to be an ideal gas.
(8) (3 points) Starting from the first law, illustrate that the time behavior of temperature is
given by
3 dT dV
nR = Q0 − p
2 dt dt
where n is the number of moles, R is the universal gas constant and Q 0 is the heat transfer
per unit time toward the balloon which can be approximated as 10(T ai r − T ).
In your notebook, give the derivation.

(9) (3 points) Use the ideal gas law to rewrite the work term and obtain the energy balance as
5 dT nRT d p
nR = Q0 +
2 dt p dt
In your notebook, give the derivation.
The air pressure as function of the elevation h is aproximately an exponential function, i.e.
g M ai r h

p ai r (h) = p 0 e RT0

where the subscript 0 signifies at zero elevation (sea level), g is the gravitational accelera-
tion (9.81 m/s 2 ) and M ai r is the molar mass of air (0.029 kg/mol). Further, we assume the
air temperature decreases linearly with elevation, i.e.
T ai r (h) = 288 − 0.0065h
and the pressure in the balloon is equal to the outside air pressure. The balloon contains
50 moles of Helium.
(10) (3 points) The rate of change of the pressure of the balloon is of the form
dp
=Kp
dt
Show that K = −(g M ai r /RT0 ) ddht .
In your notebook, give the derivation.
The temperature of the balloon is thus described by an ordinary differential equation. We
4 STATISTICAL PHYSICS: COMPUTATIONAL ASSIGNMENT I

will solve it using the Euler-explicit method. For an ODE of the form, d T /d t = f (T ) a single
time step reads
T n+1 = T n + ∆t f (T n )
Here, ∆t is the numerical time step. T n is the present temperature and T n+1 is the temper-
ature at the new time level.
(11) (15 points) Determine and plot the temperature in the balloon as a function of elevation
(between 0 and 5000 m). In the same plot add the case where there is no heat transfer with
the air.
In your notebook, provide a plot of the temperature as function of height for the cases with
and without heat transfer.
Hint: Use at least 100 time steps otherwise stability issues may occur.
Submit this assignment following the instructions on the first page.

You might also like