How to Use This Demo

Follow these steps to experience the simulation:

  1. Set the needle length l and grid spacings a, b. For the classical formula to apply, ensure l ≤ min(a, b).
  2. Set N, the number of needles to drop in one batch.
  3. Click Drop One Needle to observe a single trial and its result.
  4. Click Run N times to run a batch and compare the empirical probability with the theoretical probability.
  5. Try increasing N to see the empirical result become more stable.
  6. Click Reset or change any parameter to start fresh.

Control Panel

Set parameters and start the simulation.

Display Area

Total Trials 0
Total Hits 0
Empirical Probability 0.0000
Theoretical Probability 0.0000
Probability Error 0.0000
Last Result No trial yet
Estimated π
π Error