** Next:** Importance Sampling. Metropolis Algorithm
**Up:** Importance Sampling. Monte Carlo
** Previous:** Importance Sampling. Monte Carlo

**Classical System:**- Phase Space
^{} **Distribution function for the***NVT*-ensemble:**Ensemble Average for the quantity :**-
(1) *N*-dimensional space. The contribution from the momentum part is trivial, and can be taken into account*a posteriori*. **Brute Force Approach:**- We can try to calculate the integrals in (1)
directly.
It works for simple systems, like the
*Harmonic oscillator*for instance.

Or we can calculate it numerically using e.g. Simpson's rule, if the energy function is more complex.But if it's a system of the

*N*particles, integrals are over the*6N*dimensional space and we would have to evaluate the function at the grid of**points!!!!** **Monte Carlo method for calculating integrals:**- An integral of a function
*f*(*x*) on the interval [*a*,*b*] can be represented as: This is a key to the Monte Carlo method for calculating integrals:- 1.
- throw
*n*points at random positions*x*_{i}within the interval (or region for the multi-dimensional case) - 2.
- calculate the average
- 3.
- accuracy of the average is estimated by calculating the deviation:

**Fortran code Example 1 :**- Here is an
example of the Fortran code to calculate integral of the
*x*from to 1 by Monte Carlo method^{2}^{}. Code.

© 1997

Tue Nov 4 23:48:52 EST 1997