Monte Carlo Approximation of π
This example from statistics shows how to use the probabilistic Monte Carlo method to estimate the value of π:
- A number of points are selected at random within a square with an inscribed circle
- The number of points inside the circle divided by the total number of points will result in an approximation of π/4. We multiply by 4 to get the estimate for π.
Adjust the number of points being plotted and see how it affects the approximation of Pi.