In order to get sensible, accurate results when simulating statistical systems with a rapidly varying Boltzmann distribution, it is vital to use the idea of importance sampling in Monte Carlo integration.
Clearly the ideal situation would be to sample configurations with a probability given by their Boltzmann weight . Then the Monte Carlo average for M would just be:
This is great! Except that the sampling probability depends on the partition function Z, which is basically what we are trying to calculate in the first place!
If we don't know what is, how can we do this?