Monte Carlo Simulation
Estimating Pi Using Circle Simulation
Kruthi Jayaram
June 2025
Introduction
• Monte Carlo Simulation uses random sampling
to estimate results.
• A famous example is estimating the value of π
(Pi) using points in a circle.
Circle Simulation Example
• Imagine a square with a circle inscribed in it.
• Generate random (x, y) points in the square.
• If (x² + y²) < 1, point lies inside the circle.
• Pi ≈ 4 × (Points in circle / Total points)
Steps to Estimate Pi
• 1. Generate N random (x, y) points in [-1, 1]
• 2. Count points inside the unit circle
• 3. Use the ratio to approximate π
• Repeat thousands of times for better accuracy.
Python Code Example
• import random
• inside = 0
• total = 10000
• for _ in range(total):
• x, y = [Link](-1, 1),
[Link](-1, 1)
• if x**2 + y**2 <= 1:
• inside += 1
• pi_estimate = 4 * inside / total
Visualization Concept
Circle inside a square:
• Red dots = points outside circle
• Blue dots = points inside circle
The ratio of blue to total approximates π / 4.
Accuracy with Simulation Size
• With 1,000 samples: π ≈ 3.1
• With 10,000 samples: π ≈ 3.14
• With 1,000,000 samples: π ≈ 3.1415
• Larger simulations give better results.
Advantages
• - Simple concept, powerful estimation
• - Works for complex integrals
• - No need for exact formulas
Limitations
• - Needs large number of points
• - Randomness affects precision
• - Slower convergence compared to analytical
methods
Software Tools
• - Python (random, numpy)
• - MATLAB
• - Excel (with VBA)
• -R
Conclusion
• Monte Carlo Simulation effectively models
randomness.
• The circle example shows the power of
random sampling.
• Pi can be estimated with surprising accuracy.
Q&A
• Any Questions?