Hamiltonian
The Hamiltonian of the Ising model, which is a model of ferromagnetism, is defined by spins (now +1 or -1) and constants as
where represents the nearest neighbors.
I will solve this by the Metropolis method under a periodic boundary condition.
Parameters
The Boltzmann constant ,
the temperature ,
the initial condition: An random matrix, .
The number of cells whose spin values are inverted at once: 1.
The critical temperature here is (exact solution) or more roughly 4 (mean-field approximation) and it is proportional to the constant .
Result
Matrix calculation: Julia,
plot: Python.
The result below is a GIF composed of 204 png images taken and saved at the appropriate moments. Due to file size (<10 MB) restriction, the original file was split and only 165 shots were uploaded.
We can see how the spins, which were disordered and entropy dominant, are converging into a large-scale structure.