Monte Carlo Simulations: For When Math Is Just Too Hard

“Monte Carlo simulations are used to model the probability of different outcomes in a process that cannot easily be predicted due to the intervention of random variables.“ (Investopedia, 2019) For me, ease of prediction is completely relative. If doing the math on a process proves itself too cumbersome or boring, I will often just run a simulation of whatever phenomenon I am interested in and extract approximate odds from that.

For example, let’s play a game where you roll a die 10 times. If the roll is even, we will add the roll’s value to our score; if odd, we subtract. What do you expect your score to be?

You might be able to determine this with a minute or two of careful thought, but this example is designed to demonstrate a potential approach to problems that are too difficult to do the math for. As a result, let’s skip the math behind this and jump directly into writing some code to do it for us.

Using these simple game rules we rapidly play the game a total of 10,000 times. I calculated that the final score after 10 roles is, on average, 5.004; or essentially 5. Hopefully if you did the math corresponding to this rule set, you would come across the same result.

Does this result make sense? Well, the even numbers are an average of 0.5 higher than the odd numbers. Propagated over 10 rolls, we can logic that we would end up, on average, with a score of 5. Let’s look into the performance of this game a bit more though.

Plotting the outcomes of the simulation separated out by percentile provides an interesting graph.

Figure Generated Using Python Library “Matplotlib” [matplotlib.org]

If you were to actually play this game with a friend of yours, this plot tells you exactly what odds you should take for any target score. For example, if your friend offered you anything better than 4:1 odds against you if you produced a score of 15 or more, you should take that bet. That is, you should be willing to put up $100 if the prize for winning is anything greater than $25.

Of course this is just a trivial example, but techniques like this can be expanded to any system that you want to observe. Seeing other people’s Monte Carlo simulations can teach you novel things that you may have never considered to consider before.
If you decide to try this out, be sure to send me what you analyzed at

[contact@thornewolf (dot) com].

I’d love to see!

This piece was originally published on Mar. 23, 2020 in Horizons Newspaper, the student-run publication from the Embry-Riddle Aeronautical University's Prescott campus.

Subscribe to Thorne Wolfenbarger - Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe