## Simulation – Monte Carlo Method

The Monte Carlo Method (or Simulation) is a way to predict possible outcomes of an event probabilistically. It is named after Monaco, an independent city-state in the Mediterranean  known for its casinos. The main idea is solving a problem  by generating random numbers and observing the fraction of the numbers obeying a certain property.

More formally, each uncertain factor in an event is replaced with a range of possible outcomes (also called a probability distribution). The results of the event are then calculated for each possible set of values, creating a new probability distribution for possible outcomes. This provides not only a set of possible outcomes but also the probabilities with which each outcome may occur. Other benefits of the method are that the results can easily be represented graphically and can show the relationships between different factors, as well as their relative effects on the outcome as a whole.

The basic steps involved in performing the Monte Carlo simulation are:

1. Define a domain of possible inputs.
2. Generate possible inputs randomly from a probability distribution over the domain.
3. Perform a deterministic computation on the inputs.
4. Aggregate the results.

See the Wikipedia link for an interesting example of a simple Monte Carlo simulation for approximating the value of pi. It includes a nice visual representation of the process and results. This simulation could be done as a hands-on class activity.