A computer simulation of a two-level system Quantum statistical mechanics: A spin in a magnetic field
Consider the same magnetic moment with spin-one-half in a magnetic field that we looked at in an earlier problem. The units of the magnetic field are again chosen such that the energy of the system is just
E = -hσ
The system is in contact with a heat reservoir at temperature T. For this problem, instead of doing an analytic calculation, we will carry out a computer simulation using the Monte Carlo method. Although this might seem to be the hard way to do it, we will see later that the method can be generalized to solve problems that do not have analytic solutions.
1. Write a computer program to simulate this two-level system. The program should calculate the thermal probability of being in each state, as well as the average magnetization and the magnetic susceptibility. Have the program print out of the theoretical values for comparison.
2. Use your program to calculate the magnetization and magnetic susceptibility for a set of ‘interesting' values of the magnetic field and temperature.