Skip to content

Monte Carlo and the Ising model

This page goes beyond the school syllabus, into the methods of a university course in statistical and computational physics. The four experiments have one thing in common: nothing in them is followed by Newton’s laws. Each is run by chance, with random numbers, and the physics is in the averages. They are in the Thermal tab of the playground, after the gas.

Live in your browser: every molecule followed by the engine.Open in the playground with sliders and graphs ↗

Draw a square, and inside it a quarter of a circle that just fits. Throw points at the square without aiming. The chance that a point lands inside the curve is the ratio of the two areas, π/4\pi/4. So count: four times the fraction inside is an estimate of π\pi.

Watch how it converges. It is close after a few hundred points and then improves painfully slowly. The dashed band on the graph is the error statistics predicts, and it narrows only as one over the square root of the number of points. A hundred times the work buys one more decimal place. That is the price of every Monte Carlo method, and its strength is that the price is the same for a problem in a hundred dimensions as in two.

Live in your browser: every molecule followed by the engine.Open in the playground with sliders and graphs ↗

Two thousand walkers start together. At every tick each takes one step, north, south, east or west, chosen at random. Follow any one and it wanders aimlessly, as likely to come back as to go on. But the crowd as a whole spreads in a perfectly orderly way. The dashed circle is at a distance of the square root of the number of steps, and the crowd fills it. Four times as long to spread twice as far.

This is what diffusion is: ink in water, heat along a rod, the Brownian grain on the kinetic theory page. Nothing drives the spreading. It is only that there are more ways to be spread out than bunched up.

Live in your browser: every molecule followed by the engine.Open in the playground with sliders and graphs ↗

Each little square is the spin of one atom, pointing up or down. A spin has lower energy when it agrees with its four neighbours, so left to themselves they would all line up: a magnet. Heat works against that, flipping spins at random.

Open the parameters and move the temperature. Well below 2.27 the lattice is nearly all one colour, with a few spins knocked out of line. Well above, it is a fine-grained flicker with no overall magnetisation. Close to 2.27 it is neither: patches of every size, forming and dissolving, slow to make up its mind. That is a system at a critical point. Add a field and the spins favour its direction even when hot.

Cooling a magnet through its critical point

Section titled “Cooling a magnet through its critical point”
Live in your browser: every molecule followed by the engine.Open in the playground with sliders and graphs ↗

Now the experiment a laboratory would do. The lattice starts hot and disordered and is cooled in 25 steps. At each temperature it is given time to settle and is then measured. Watch the graph fill in from the right.

For a long while nothing happens: the magnetisation stays near zero. Then, over a narrow range of temperature, it rises steeply and levels off near one. The dashed curve is Onsager’s exact answer, which turns on instantly at the critical temperature; the lattice follows it everywhere but in the rounded corner. Switch the graph to specific heat and there is a peak at the same place: just there, a little heat goes a long way in rearranging the spins.

Nobody put a transition into the program. There are only spins, their neighbours, and a rule for flipping.