Some problems are very hard (or even impossible) to solve exactly. For some of those problems, you can get a decent guess (sometimes a very very good guess) by using randomness to check for a result.
To make the Monte Carlo method work, you need to program two things into a computer. First, you need a range of options that you can sample from randomly. Second, you need a condition that is easy to test for whether it is true or not. Once you have both of those, you repeatedly take samples, until you have enough to draw useful conclusions (usually hundreds or thousands of samples *minimum*). If you did the setup correctly, you’ll be able to use the results to get an approximate answer to the original hard question.
Others have used the “what is the area of a circle” example. It also works for a bunch of other things, like predicting future weather patterns based on random inputs, or future stock behaviors, or a bunch of other things, both situations where we know there’s a definite answer and ones where we don’t.
Latest Answers