2.4. Practical QuestionsΒΆ
In this goal we will create a simple computer program to compute the Boltzmann distribution of a fictious harmonic oscillator.
Modify the code presented in section Appendix: Python code or Appendix: C++ code to calculate the occupancy of each state within the harmonic oscillator system. Present the entire code file within your report and comment upon the main features using
#(Python) or\\(C++)Calculate using your program the occupancy of each state within the harmonic oscillator at the reduced temperatures of 0.5, 1, 2 and 3, with
numberOfEnergyLevelsset to 10 (recall \(\epsilon = 1\)). Using the output file the code generates, plot the distribution and present the graphs in your report. What do you note at higher temperature?Change the
calculateStateOccupancy()function such that the degeneracies \((s + 1)\) and \((s + 5)\) are considered, where \(s\) is the index of the energy level (usenumberOfEnergyLevels= 10 andreducedTemperature= 0.5). Plot the results and include the graphs in your report. What can you infer from this trend?Modify your program such that the state occupancy and partition function are calculated for a linear rotor with moment of inertia \(I\). Compare your results at different temperatures with the approximate result:
\[ Z = \frac{2I}{\beta\hbar^2} \]using
\[ \frac{I}{\hbar^2} = 1. \]Note that the energy levels of a linear rotor are:
\[ U = J(J+1)\frac{\hbar^2}{2I} \]with \(J= 0, 1, 2, \dots, \infty\) and the degeneracy of level J is \(2J +1\).