# Introduction to Mathematical Physics/Statistical physics/Some numerical computation in statistical physics

In statistical physics, mean quantities evaluation can be done using by Monte--Carlo methods. in this section, a simple example is presented.

**Example:**

Let us consider a Ising model. In this spin system, energy can be written:

The following Metropolis algorithm [ma:compu:Stauffer93], [ma:compu:Koonin90] is used \index{Metropolis} to simulate probabilities :

- select spin to consider.
- evaluate variation of energy associated to a possible split of spin .
- compare a random number between zero and one with probability .
- split spin number (that is do ) i=f and only if .
- use the obtained configuration to compute mean quantities.