Problem 2.9

Einstein solid with ‘n’ oscillators and ‘q’ energy units:

Ω[n_, q_] := (((q + n - 1)!)/(q! (n-1)!))

Reproduce the table in Figure 2.4.
Systems A and B

nA = 3; nB = 3; qTotal = 6;

Systems A and B.  The total number of microstates can be determined by considering all the ways to allocate the qTotal units of energy among the total nA+nB number of oscillators.

ntotal = Ω[nA + nB, qTotal]

Form a data table like those in the text, but add in a probability column for completeness.

data = Table[{qA, ΩA = Ω[nA, qA], qB = qTotal - qA, ΩB = Ω[nB, qB], ΩA * ΩB, ΩA*ΩB / ntotal }, {qA, 0, qTotal}];

TableForm[data, TableHeadings->{None, {"qA", "ΩA", "qB", "ΩB", "Ωtotal", "probability"}}]

The total number of microstates was computed above .  Alternatively, you could add up column 5 to get the total number of microstates .

Total[data[[All, 5]]] (* Add up column 5 to get the total number of macrostates *)

BarChart[data[[All, 5]], LabelStyle->Larger, AxesLabel -> {"qA", "Ωtotal"}, ImageSize->Scaled[0.8], ChartLabels->data[[All, 1]]]

Modify for nA = 6, nB = 4, qtotal still = 6.

nA = 6; nB = 4; qTotal = 6;

ntotal = Ω[nA + nB, qTotal]

Here, it will be convenient to express the probability as a real number, rather than an exact integer fraction.

data = Table[{qA, ΩA = Ω[nA, qA], qB = qTotal - qA, ΩB = Ω[nB, qB], ΩA * ΩB, N[ΩA*ΩB / ntotal] }, {qA, 0, qTotal}];

TableForm[data, TableHeadings->{None, {"qA", "ΩA", "qB", "ΩB", "Ωtotal", "probability"}}]

BarChart[data[[All, 5]], LabelStyle->Larger, AxesLabel -> {"qA", "Ωtotal"}, ImageSize->Scaled[0.8], ChartLabels->data[[All, 1]]]

Most-probable macrostate

TableForm[data, TableHeadings->{None, {"qA", "ΩA", "qB", "ΩB", "Ωtotal", "Probability"}}]

The most probable state is qA = 4, with 1260 total microstates, and a probability of about 25%.

max = MaximalBy[data, #[[5]] &][[1]]

Least-probable macrostate

The least probable state is qA = 0, with 84 total microstates.

min = MinimalBy[data, #[[5]] &][[1]]