Monte Carlo Pi Estimator Back EN | ZH
Monte Carlo Simulation

Monte Carlo Pi Estimator

Drop random points into a unit square and count how many land inside the inscribed circle. Watch π emerge from pure probability — and see how error shrinks with more samples.

Parameters
Batch size (pts/step) 500
Frame interval (ms) 80 ms
Convergence Log
— Waiting for simulation to start —
π Estimate
0
Total Samples N
0
Hits Inside Circle
Relative Error
95% Confidence Interval
3.14159…
True π
π Estimate Convergence

Theory

For a uniform random point $(x, y)$ in the unit square $[-1,1]^2$, the probability of landing inside the unit circle $x^2+y^2 \le 1$ is $\pi/4$. Therefore:

$$\pi \approx 4 \times \frac{\text{points inside circle}}{\text{total points } N}$$

Standard error: $\sigma_\pi \approx \dfrac{4\sqrt{p(1-p)}}{\sqrt{N}}$, where $p = \pi/4 \approx 0.785$

Convergence rate: error $\propto 1/\sqrt{N}$ — 10× more accuracy requires 100× more samples.

CAE & Numerical Analysis Connection: Monte Carlo methods are widely used in high-dimensional integration, structural reliability analysis (complementing FORM/SORM), parameter sensitivity studies, and uncertainty quantification. MC-FEM combines random sampling with finite element models to evaluate failure probability under material and geometric variability.