Journal of Undergraduate
Research
Volume 7, Issue 6 - July/August 2006
Monte Carlo Calculations for Rapidly Changing Distributions
Arif H. Ahmed and John R. Klauder
ABSTRACT
Many dimensional integrals are frequently approximated numerically by using importance sampling in Monte Carlo calculations. However, certain distributions of interest involve rapidly changing behavior and conventional Monte Carlo methods are unsuitable in such cases. For this work, we show that a modified Monte Carlo procedure produces satisfactory results.
INTRODUCTION
The Monte Carlo method can be best described in terms of a relationship between geometric and algebraic aspects of theoretical science. Over the years, powerful methods expressing solutions of probabilistic problems in analytical terms have been developed. With the advancement of computational power, now the statistical problems can be modeled directly, allowing solving of any problem with an analytical expression resembling a probability problem by constructing a realization of the random variable problem.
Contemporary problems in physics often require working with systems with a large number of degrees of freedom. Among these are many atoms in a chunk of condensed matter, the many electrons in an atom, or the infinitely many values of a quantum field at all points in a region of space-time. These systems are often described by the evaluation of integrals of very high dimension. The straightforward evaluation of such integrals is almost impossible in conventional ways. The Monte Carlo method [1-3] provides ways of efficiently evaluating integrals of high dimension.
The Monte Carlo Method
Since it is not very clear how one can actually calculate an integral with random numbers, we can start out with a simple two dimensional problem. Consider a square with corners at (±1/2, ±1/2) and we want to calculate the area of a circle inscribed within it. If we select a number of uniformly distributed points in the square at random, we know that the probability that they will fall within the circle is equal to the ratio of the areas, which is π/4. The fraction of points that fall within the circle will represent the area of the circle.
Consider an integral of the form
(1)
By normalization, we can modify the problem such that
(2)
Now g(x) can be regarded as a probability distribution function, over which we can compute the average of the function f(x) (denoted as <f>).
(3)
If we draw a large number, N, of random values of x from the distribution described by g(x), we can directly estimate the average value of f(x) by
(4)
This equation forms the basis of Monte Carlo evaluations of integrals, and the set of N xi are the realization of the probability distribution function, g(x).
Even though computationally intensive, in the Monte Carlo method the computation time increase is only linear (sometimes quadratic) with additional dimensions, while for a classical approach, it is exponential.
The Metropolis Algorithm
Even though the basic Monte Carlo method itself improves the multidimensional integral problem we are trying to solve, it is not the most efficient technique to sample. The Metropolis algorithm represents the function in a new way, leading to a more efficient and accurate way of solving physical problems.
The Metropolis algorithm is based on the concept of a random walk. In the two dimensional classical random walk, a sample point starts at the origin of an x-y coordinate system, and with successive iteration, is allowed to move one unit in any coordinate direction in the plane with equal probability. In principle, with much iteration, this will cover the entire 2-dimensional space. But for an efficient approach, we want the walker to spend more time in regions where the function to be sampled is large, rather than covering the entire space. This will provide a better realization of the probability density function since the probability of finding a sample walker in a given region should be the same as g(x1, x2 … … xα).
Difficulties in evaluating rapidly changing probability density functions and possible solutions
One of the main principles of a Monte Carlo calculation for integrals is that we have a distribution function g(x) that represents the weight function. To describe how g(x) acts, one obvious question that arises is how we choose the step size of the walker. If the step size is large, then most of the trial steps will be rejected. If the step size is very small, then most trial steps will be accepted, but the random walker will never move too far, thus generating a poor sample of the function of interest.
Also, not all distribution functions are expected to have a smooth shape that can be easily captured by numerical simulation. Most real life problems involve discontinuities or sharp changes.
In our specific application, the function of interest [4] is:
(5)
which has the following probability distribution function:
(6)
where m=1, r=0, and our main goal was to observe the effect of ε in evaluating our function of interest.
To help visualize the rapid change in g, we can consider the plot of the function g(x) with ε = 0 and ε = 0.1.
We notice that for smaller ε values, the change is much sharper than for larger ε values, confirming our expectations.
In the modified Metropolis algorithm, random G(x) values were picked and corresponding x values were used to find the proper walk for the simulation. From the plots in figure 2 we can observe that much of the rapid changes occurring near the vertical axis were captured well, thus providing an accurate representation of the function of interest.
Calculation of average quantities for conditions of interest
For our particular problem, we considered three average quantities of interest. Measurements for 5 different ε values for 3 different dimensions were evaluated. For each walk associated with a particular dimension, 10,000 steps were taken to reach the best g-distributed value, and the following tables listing the average quantities were calculated.
| Table 1a Average quantities for multiple ε values in 4 dimensional case |
|||||
| Dimension | ε | <(x1+x2+...+xα)2> | <(x1+x2+...+xα)4> | <(x1-x2+...-xα)2> | |
|---|---|---|---|---|---|
| 4 | 0.01 | 1 | 2.372894 | 27.600760 | 0.014256 |
| 2 | 2.254091 | 26.043820 | 0.014312 | ||
| 3 | 2.257402 | 27.149090 | 0.014750 | ||
| 4 | 2.290345 | 27.421420 | 0.014941 | ||
| 5 | 2.275923 | 27.353530 | 0.014876 | ||
| Average | 2.290131 | 27.113724 | 0.014627 | ||
| 0.03 | 1 | 4.103755 | 49.661130 | 0.018628 | |
| 2 | 3.974865 | 47.617950 | 0.018215 | ||
| 3 | 4.054404 | 49.273250 | 0.018368 | ||
| 4 | 3.949187 | 44.467420 | 0.018186 | ||
| 5 | 4.160061 | 51.102490 | 0.018057 | ||
| Average | 4.048454 | 48.424448 | 0.018291 | ||
| 0.1 | 1 | 4.203332 | 53.437510 | 0.019771 | |
| 2 | 4.018090 | 47.792260 | 0.020733 | ||
| 3 | 4.046690 | 49.089840 | 0.020126 | ||
| 4 | 4.056378 | 52.086820 | 0.019877 | ||
| 5 | 4.039746 | 49.550120 | 0.019974 | ||
| Average | 4.072847 | 50.391310 | 0.020096 | ||
| 0.3 | 1 | 3.196445 | 37.292830 | 0.087355 | |
| 2 | 3.402900 | 41.011890 | 0.086050 | ||
| 3 | 3.238157 | 37.976700 | 0.086128 | ||
| 4 | 3.250775 | 37.765000 | 0.086484 | ||
| 5 | 3.307907 | 38.607500 | 0.084001 | ||
| Average | 3.279237 | 38.530784 | 0.086004 | ||
| 1 | 1 | 3.812564 | 45.014400 | 0.822925 | |
| 2 | 3.823280 | 45.073460 | 0.803394 | ||
| 3 | 3.801923 | 43.250480 | 0.789291 | ||
| 4 | 3.808497 | 43.529210 | 0.809626 | ||
| 5 | 3.898975 | 44.075400 | 0.807208 | ||
| Average | 3.829048 | 44.188590 | 0.806489 | ||
| Table 1b Average quantities for multiple ε values in 8 dimensional case |
|||||
| Dimension | ε | <(x1+x2+...+xα)2> | <(x1+x2+...+xα)4> | <(x1-x2+...-xα)2> | |
|---|---|---|---|---|---|
| 6 | 0.01 | 1 | 3.187484 | 49.517320 | 0.098564 |
| 2 | 3.298165 | 50.322020 | 0.102182 | ||
| 3 | 3.171618 | 50.048190 | 0.100031 | ||
| 4 | 3.267409 | 52.860170 | 0.096612 | ||
| 5 | 3.115363 | 49.467500 | 0.101744 | ||
| Average | 3.208008 | 50.443040 | 0.099827 | ||
| 0.03 | 1 | 5.981388 | 101.426500 | 0.115825 | |
| 2 | 6.114906 | 112.577800 | 0.117399 | ||
| 3 | 6.107915 | 106.124900 | 0.119357 | ||
| 4 | 6.128047 | 110.454900 | 0.117391 | ||
| 5 | 6.028111 | 110.364400 | 0.118371 | ||
| Average | 6.072073 | 108.189700 | 0.117669 | ||
| 0.1 | 1 | 6.279786 | 120.921400 | 0.118232 | |
| 2 | 5.929829 | 110.564400 | 0.122510 | ||
| 3 | 6.036225 | 113.857900 | 0.122996 | ||
| 4 | 5.831763 | 102.249600 | 0.122375 | ||
| 5 | 6.380465 | 121.878200 | 0.123563 | ||
| Average | 6.091614 | 113.894300 | 0.121935 | ||
| 0.3 | 1 | 4.431448 | 71.604790 | 0.157009 | |
| 2 | 4.530405 | 78.695210 | 0.152096 | ||
| 3 | 4.359631 | 71.137640 | 0.148036 | ||
| 4 | 4.511994 | 82.563610 | 0.150954 | ||
| 5 | 4.530857 | 81.285420 | 0.153071 | ||
| Average | 4.472867 | 77.057334 | 0.152233 | ||
| 1 | 1 | 5.936424 | 103.787800 | 1.205079 | |
| 2 | 5.710717 | 99.817270 | 1.233117 | ||
| 3 | 5.800452 | 102.954200 | 1.154434 | ||
| 4 | 5.818944 | 102.076700 | 1.195567 | ||
| 5 | 5.690309 | 96.302720 | 1.173799 | ||
| Average | 5.791369 | 100.987738 | 1.192399 | ||
| Table 1c Average quantities for multiple ε values in 8 dimensional case |
|||||
| Dimension | ε | <(x1+x2+...+xα)2> | <(x1+x2+...+xα)4> | <(x1-x2+...-xα)2> | |
|---|---|---|---|---|---|
| 8 | 0.01 | 1 | 4.947606 | 98.743290 | 0.267767 |
| 2 | 4.935928 | 90.248240 | 0.262745 | ||
| 3 | 4.831919 | 89.233780 | 0.262485 | ||
| 4 | 4.925486 | 97.237760 | 0.263914 | ||
| 5 | 4.914007 | 104.121500 | 0.266337 | ||
| Average | 4.910989 | 95.916914 | 0.264650 | ||
| 0.03 | 1 | 8.402897 | 212.046300 | 0.301671 | |
| 2 | 8.025216 | 190.487000 | 0.299496 | ||
| 3 | 8.131671 | 196.988500 | 0.309308 | ||
| 4 | 8.330724 | 212.736100 | 0.307924 | ||
| 5 | 8.350036 | 203.040600 | 0.303678 | ||
| Average | 8.248109 | 203.059700 | 0.304415 | ||
| 0.1 | 1 | 7.892954 | 196.923200 | 0.299320 | |
| 2 | 8.231554 | 197.371200 | 0.312714 | ||
| 3 | 8.228297 | 204.173500 | 0.312640 | ||
| 4 | 7.906247 | 187.708900 | 0.317026 | ||
| 5 | 8.191574 | 206.288800 | 0.314330 | ||
| Average | 8.090125 | 198.493120 | 0.311206 | ||
| 0.3 | 1 | 6.055274 | 128.732500 | 0.301544 | |
| 2 | 6.315698 | 142.669800 | 0.296209 | ||
| 3 | 6.021224 | 123.822600 | 0.305802 | ||
| 4 | 6.077973 | 129.160200 | 0.301952 | ||
| 5 | 6.121105 | 128.387800 | 0.309325 | ||
| Average | 6.118255 | 130.554580 | 0.302966 | ||
| 1 | 1 | 7.636328 | 174.721300 | 1.602424 | |
| 2 | 7.623882 | 180.288100 | 1.589588 | ||
| 3 | 7.502346 | 174.024500 | 1.541765 | ||
| 4 | 7.853995 | 190.328700 | 1.557270 | ||
| 5 | 7.677142 | 175.115900 | 1.538960 | ||
| Average | 7.658739 | 178.895700 | 1.566001 | ||
CONCLUSION
From tables 1a, b and c, we can conclude that even though the calculation involved random numbers, the answers to the average quantities were very precise for the same parameters. This shows that we can depend on the calculation method for consistent results. We also note that for particular ε values, the average quantities for different dimensions have a consistent ratio representing a linear trend.
One of our main purposes of the study was to observe whether the Monte Carlo method can detect the rapidly changing characteristics of the distribution function. From the results obtained above, we notice that the different ε values resulted in different values for the average quantities. We can conclude that the algorithm does indeed take the rapid change of the probability density function into account.
Even though the modified Metropolis algorithm of the Monte Carlo method was successful in our case, we found it to be computationally intensive. For larger models, having thousands of dimensions, it might not be a suitable procedure with current resources available. Further investigation could be carried out to improve the computation time, for example, by taking fewer walks, but still obtaining a statistically significant answer.
REFERENCES
- Metropolis, Nicholas, Rosenbluth, Marshall. “Equation of State Calculations by Fast Computing Machines.” The Journal of Chemical Physics. 21 (1953): 1087-1092.
- Gibbs, William R. “Introduction to Monte Carlo.” Computation in Modern Physics. World Scientific (1994). 28-52.
- Koonin, Steven E. “Monte Carlo Methods.” Computational Physics. Benjamin/Cummings (1986).185-215.
- Klauder, John R. “Ultralocal Models: Functional integral formulation.” Beyond Conventional Quantization. Cambridge University Press (2000). 260-263.
