Monte Carlo Simulation-An Overview

Monte Carlo Simulation-An Overview
Image by Danni Liu

During my studies in Applied Finance years ago, I recall sitting in an economics class, slightly disengaged and restless. However, the moment my lecturer announced the topic for the day was "Monte Carlo simulation", my attention snapped back. Oddly enough, it wasn't the financial implications that intrigued me but rather a nostalgic connection. It reminded me of the Circuit de Monaco.

"Monte Carlo" took me back to those lazy afternoons watching my brother and his friends playing Gran Turismo on Play Station racing cars. Circuit de Monaco is one of the available racetracks. It's my favourite and about the only one that I remember. That track was legit! It isn't one of those purpose-built tracks; rather, it twisted right through the streets of Monaco. You're racing against a backdrop of the blue sparkly Mediterranean, swanky yachts docked nearby, and the stunning architecture of Monte Carlo. It's pretty epic!

This bridge to this childhood memory led me to pay more attention than I typically would. I'm glad I did. Turns out, the whole Monte Carlo simulation thing is super interesting in its own right! It also has a fascinating history. So, in this blog, let's have a look at the following:

  • What is Monte Carlo Simulation?
  • History of Monte Carlo Simulation
  • Example of Monte Carlo- Estimating Pi using Monte Carlo
  • Application of Monte Carlo Simulation

What is Monte Carlo Simulation?

Monte Carlo simulation or Monte Carlo method is a powerful mathematical technique that uses random numbers to estimate uncertain event outcomes. Imagine you're playing a dice game but don't know the exact chances of winning. Instead of rolling the dice thousands of times, you use a computer to guess the chances by rolling the dice many times with random numbers. The more times you roll, the better your guess becomes- this is the law of large numbers, and it's crucial for Monte Carlo simulations.

The Law of Large Numbers is a statistical principle that tells us that if we do something many times, like tossing a fair coin repeatedly, the average of our results will eventually get very close to what we'd expect. So, if you flip that coin a lot, you'll get very close to half heads and half tails. This law shows that with enough tries, randomness becomes predictable, and our average result becomes what we would predict.

History of Monte Carlo Simulation

Monte Carlo simulation is a powerful mathematical technique with a fascinating history. It was developed by a Polish scientist/mathematician, Stanislaw Ulam, who was involved in the Manhattan Project during World War II. The Manhattan Project was a top-secret research and development effort focused on creating the first atomic bombs.

During his recovery from illness, Ulam got really into playing Solitaire. He wondered if he could predict how each game would turn out, but regular math wasn't up to the task.

So, he decided to play a bunch of solitaire games and keep track of how many he won and lost. During the process, he figured that by repeatedly running iterations of the game, he figured he'd get a good idea of how likely he was to win each time.

Ulam shared this idea with his Manhattan Project colleague, John von Neumann, who saw its potential not only in card games but also in nuclear science. This gave birth to the 'Monte Carlo' project. They utilised early computers to simulate the random behaviour of neutrons, much like a game of chance at the Monte Carlo Casino in Monaco, where Ulam's uncle had gambled. This simulation technique helped them predict the behaviour of nuclear explosions based on their collected data.

Example of Monte Carlo- Estimating Pi Using Monte Carlo

This example of estimating PI using Monte Carlo is a common illustration to demonstrate the concept of Monte Carlo.

Here's how you can estimate π:

We can run this simulation using a computer. The more random dots (samples) we have, the closer our result is to the expected value, which is 3.141592653589793238462643383279502884197...

Image sourced from Gigi Labs

Here is an animation explanation for those who lean more towards video content:

Approximating Pi with Monte Carlo (2:07 min)

Application of Monte Carlo Simulation

Monte Carlo Simulation has a wide range of applications across different industries. Here are some of its applications:

Finance and Investment: An example of this would be portfolio management and also in the area of investment planning. By running thousands or even millions of simulations, investors can better understand how their portfolios might perform under different market conditions.

Quality Control and Testing: estimating a product's reliability and failure rate.

Healthcare: modelling the spread of diseases like flu outbreaks. They help public health officials make informed decisions about interventions, vaccination strategies, and resource allocations.

Game Development: In video game design, it creates realistic virtual worlds and simulates natural phenomena like weather and crowd behaviour.

Logistics and supply chain: Monte Carlo simulation optimises logistics and supply chain operations, including inventory management, transportation routing, and warehouse design.

Monte Carlo simulations are pretty cool stuff, right? Using Monte Carlo simulation to estimate Pi is overkill because we have a simple formula, like calculating the area of the circle and square to solve it. However, not all problems have a simple formula; this is where Monte Carlo shines.

But, here's the kicker- Monte Carlo simulation output is undermined if the quality of random numbers. If those numbers aren't random, the results can be as reliable as a leaky umbrella in a storm. You know what they say: "Garbage in, garbage out."

Well, that's a wrap for now. Until next time, ciao~