## Introduction

Estimating the value of Pi (π) using Monte Carlo simulations is a straightforward yet profound application that illustrates the versatility of this statistical method. It also highlights the importance of selecting the appropriate probability distribution for sampling.

## The Method

The Monte Carlo method to estimate Pi involves simulating random points in a plane that includes a unit square and a circle inscribed within it. By generating a large number of points and analyzing their distribution relative to the circle and square, we can approximate the value of Pi.

### Steps Involved:

**Define the Square and Circle**: Set the boundaries of the square from (-1, -1) to (1, 1). This encloses a circle at the origin with a radius of 1.**Generate Random Points**: Simulate random (x, y) points within the square.**Count Points Inside the Circle**: Determine whether each point lies inside the circle using the equation x^2 + y^2 \leq 1.**Estimate Pi**: The ratio of the number of points inside the circle to the total number of points, multiplied by 4, gives an approximation of Pi, since we're considering a full circle within a square.

```
x = np.random.uniform(-1, 1, num_trials)
y = np.random.uniform(-1, 1, num_trials)
# Calculate distances from the origin
distances = np.sqrt(x**2 + y**2)
# Count points within the unit circle
inside_circle = distances <= 1
outside_circle = np.logical_not(inside_circle)
# Estimate Pi
pi_estimate = 4 * np.sum(inside_circle) / num_trials
```

## Importance of the Uniform Distribution

The simulation's accuracy largely depends on the probability distribution used to generate the random points. To achieve an accurate estimation, points should be sampled from a uniform distribution over the interval [-1, 1] for both x and y coordinates. This ensures that every point in the square has an equal probability of being selected, reflecting the true random nature of the process and providing uniform coverage of the area.

## What Goes Wrong with the other distributions: Normal Distribution?

Using a normal distribution to generate points can adversely affect the estimation of Pi. The normal distribution typically clusters points around its mean, resulting in uneven coverage:

**Concentration of Points**: Most points would cluster around the center of the square and the circle, not evenly over the entire area.**Edge Neglect**: Points are less likely to appear near the edges of the square, crucial areas for accurately determining the proportion of the circle to the square.

Consequently, the Pi estimation would be less accurate because the point distribution would not correctly represent the spatial probabilities required by the setup.

## Conclusion

The Monte Carlo simulation for estimating Pi not only serves as an engaging introduction to this statistical technique but also underscores the critical role of proper probability distribution in obtaining reliable results. By ensuring uniform distribution of points across the intended area, we achieve a more accurate approximation of Pi, demonstrating the effectiveness and elegance of Monte Carlo methods.

Stay tuned for more posts where we explore additional applications of Monte Carlo simulations in various fields!

## Comments