Speed (iterations per frame): 1 10 100 1000 10000
Iterations (total dots): 0
Dots in Circle: 0
Approximation of Pi: 0
This approxmiates π using a Monte Carlo method, which is an approach to computing things by statistics and random sampling.
How would we find π using statistics? Well, we can start from formulas using π. In this demo, we happen to use a circle, which has the simplest area formula involving π. Our plan is to drop dots in random positions on a square with an inscribed circle.
Somehow, we have to leverage the count of dots inside the circle compared to the number outside circle. We know this has something to do with probability, so let just use these three symbols to start with: