Estimate Pi
Monte Carlo method for π approximation using random sampling
Parameters
100100,000
Results
Run the simulation to see results
Visualization
Run the simulation to see points
Points inside circle
Points outside circle
How It Works
The Monte Carlo method for estimating π works by randomly placing points inside a square and counting how many fall within the inscribed circle.
The Algorithm:
- Generate random points (x,y) within a 1×1 square
- Count points that fall inside the inscribed quarter-circle: x² + y² ≤ 1
- The ratio of points inside the circle to total points approaches π/4
- Multiply this ratio by 4 to get an estimate of π
The accuracy of this estimate improves with more iterations, demonstrating the law of large numbers in probability theory.