# Monte Carlo method

**Monte Carlo methods** are a class of computational algorithms for simulating the behavior of various physical and mathematical systems. They are distinguished from other simulation methods (such as molecular dynamics) by being stochastic, that is nondeterministic in some manner - usually by using random numbers (or more often pseudo-random numbers) - as opposed to deterministic algorithms. A classic use is for the evaluation of definite integrals, particularly multidimensional integrals with complicated boundary conditions.

Monte Carlo methods are extremely important in computational physics and related applied fields, and have diverse applications from esoteric quantum chromodynamics calculations to designing heat shields and aerodynamic forms. These methods have proven efficient in solving the integro-differential equations defining the radiance field, and thus these methods have been used in global illumination computations which produce photorealistic images of virtual 3D models, with applications in video games, architecture, design, computer generated films, special effects in cinema, business, economics and other fields. They are especially useful in studying systems with a large number of coupled degrees of freedom, such as liquids, disordered materials, and strongly coupled solids.

Interestingly, the Monte Carlo method does not require truly random numbers to be useful. Much of the most useful techniques use deterministic, pseudo-random sequences, making it easy to test and re-run simulations. The only quality usually necessary to make good simulations is for the pseudo-random sequence to appear "random enough" in a certain sense. That is that they must either be uniformly distributed or follow another desired distribution when a large enough number of elements of the sequence are considered.

Because of the repetition of algorithms and the large number of calculations involved, Monte Carlo is a method suited to calculation using a computer, utilizing many techniques of computer simulation.

A **Monte Carlo algorithm** is a numerical Monte Carlo method used to find solutions to mathematical problems (which may have many variables) that cannot easily be solved, for example, by integral calculus, or other numerical methods. Its efficiency relative to other numerical methods increases when the dimension of the problem increases.

## Contents

## History

Monte Carlo methods were originally practiced under more generic names such as "statistical sampling". The "Monte Carlo" designation, popularized by early pioneers in the field (including Stanislaw Marcin Ulam, Enrico Fermi, John von Neumann and Nicholas Metropolis), is a reference to the famous casino in Monaco. Its use of randomness and the repetitive nature of the process are analogous to the activities conducted at a casino. Stanislaw Marcin Ulam tells in his autobiography *Adventures of a Mathematician* that the method was named in honor of his uncle, who was a gambler, at the suggestion of Metropolis.

"Random" methods of computation and experimentation (generally considered forms of stochastic simulation) can be arguably traced back to the earliest pioneers of probability theory (see, e.g., Buffon's needle, and the work on small samples by William Gosset), but are more specifically traced to the pre-electronic computing era. The general difference usually described about a Monte Carlo form of simulation is that it systematically "inverts" the typical mode of simulation, treating deterministic problems by *first* finding a probabilistic analog. Previous methods of simulation and statistical sampling generally did the opposite: using simulation to test a previously understood deterministic problem. Though examples of an "inverted" approach do exist historically, they were not considered a general method until the popularity of the Monte Carlo method spread.

Perhaps the most famous early use was by Enrico Fermi in 1930, when he used a random method to calculate the properties of the newly-discovered neutron. Monte Carlo methods were central to the simulations required for the Manhattan Project, though were strongly limited by the computational tools at the time. However, it was only after electronic computers were first built (from 1945 on) that Monte Carlo methods began to be studied in depth. In the 1950s they were used at Los Alamos for early work relating to the development of the hydrogen bomb, and became popularized in the fields of physics and operations research. The Rand Corporation and the U.S. Air Force were two of the major organizations responsible for funding and disseminating information on Monte Carlo methods during this time, and they began to find a wide application in many different fields.

Uses of Monte Carlo methods require large amounts of random numbers, and it was their use that spurred the development of pseudorandom number generators, which were far quicker to use than the tables of random numbers which had been previously used for statistical sampling.

## Integration

Deterministic methods of numerical integration operate by taking a number of evenly spaced samples from a function. In general, this works very well for functions of one variable. However, for functions of vectors, deterministic quadrature methods can be very inefficient. To numerically integrate a function of a two-dimensional vector, equally spaced grid points over a two-dimensional surface are required. For instance a 10x10 grid requires 100 points. If the vector has 100 dimensions, the same spacing on the grid would require 10^{100} points – that's far too many to be computed. 100 dimensions is by no means unreasonable, since in many physical problems, a "dimension" is equivalent to a degree of freedom.

Monte Carlo methods provide a way out of this exponential time-increase. As long as the function in question is reasonably well-behaved, it can be estimated by randomly selecting points in 100-dimensional space, and taking some kind of average of the function values at these points. By the central limit theorem, this method will display **Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 1/\sqrt{N}}**
convergence – i.e. quadrupling the number of sampled points will halve the error, regardless of the number of dimensions.

A refinement of this method is to somehow make the points random, but more likely to come from regions of high contribution to the integral than from regions of low contribution. In other words, the points should be drawn from a distribution similar in form to the integrand. Understandably, doing this precisely is just as difficult as solving the integral in the first place, but there are approximate methods available: from simply making up an integrable function thought to be similar, to one of the adaptive routines discussed in the topics listed below.

A similar approach, is using low-discrepancy sequences with the quasi-Monte Carlo method. Quasi-Monte Carlo methods can often be more efficient at numerical integration because the sequence "fills" the area better in a sense and samples more of the most important points that can make the simulation converge to the desired solution more quickly.

### Integration methods

- Direct sampling methods
- Random walk Monte Carlo including Markov chains
- Gibbs sampling

## Optimization

Another powerful and very popular application for random numbers in numerical simulation is in numerical optimisation. These problems use functions of some often large-dimensional vector that are to be minimized. Many problems can be phrased in this way: for example a computer chess program could be seen as trying to find the optimal set of, say, 10 moves which produces the best evaluation function at the end. The traveling salesman problem is another optimisation problem. There are also applications to engineering design, such as multidisciplinary design optimization.

Most Monte Carlo optimisation methods are based on random walks. Essentially, the program will move around a marker in multi-dimensional space, tending to move in directions which lead to a lower function, but sometimes moving against the gradient.

### Optimisation methods

## Other methods

- Assorted random models, e.g. self-organised criticality
- Direct Simulation Monte Carlo
- Dynamic Monte Carlo method
- Quantum Monte Carlo
- Quasi-Monte Carlo method using low-discrepancy sequences and self avoiding walks
- Semiconductor charge transport and the like
- Stochastic Optimization

## See also

### Application areas

- Graphics, particularly for ray tracing; a version of the Metropolis-Hastings algorithm is also used for ray tracing when it is known as Metropolis light transport
- Modelling light transport in multi-layered tissues (MCML)
- Monte Carlo methods in finance

## References

- Bernd A. Berg, ``Markov Chain Monte Carlo Simulations and Their Statistical Analysis (With Web-Based Fortran Code)
*, World Scientific 2004, ISBN 981-238-935-0.* - P. Kevin MacKeown,
*Stochastic Simulation in Physics*, 1997, ISBN 981-3083-26-3 - Harvey Gould & Jan Tobochnik,
*An Introduction to Computer Simulation Methods, Part 2, Applications to Physical Systems*, 1988, ISBN 0-201-16504-X - C.P. Robert and G. Casella. "Monte Carlo Statistical Methods" (second edition). New York: Springer-Verlag, 2004, ISBN 0-387-21239-6
- Makers of commercial packages which implement Monte Carlo algorithms in Microsoft Excel include Palisade Corporation (@Risk) and Decisioneering (Crystal Ball).

de:Monte-Carlo-Algorithmus es:Método de Monte Carlo fr:Méthode de Monte-Carlo it:Metodo Monte Carlo he:שיטת מונטה קרלו nl:Monte-Carlosimulatie ja:モンテカルロ法 pl:Metoda Monte Carlo pt:Método Monte Carlo su:Metoda Monte Carlo vi:Phương pháp Monte Carlo zh:蒙特·卡罗方法