# Estimation of pi using Monte Carlo method

**Statement of problem**

Let two random variables $X$ and $Y$ be in $[-1,1]$ and distributed uniformly. Probability that point given with coordinates $(X, Y)$ lies in unit circle (i.e. $X^2 + Y^2 < 1$) is:

\begin{equation}
p = \frac{S_C}{S_S} = \frac{r^2 \pi}{a^2} = \frac{\pi}{4}
\end{equation}

**Method**

Generate $N$ pairs of $(X, Y)$ and calculate how many of them lay in unit circle, $N_<$. Then estimate probability that point is in circle by:

\begin{equation}
p_< = \frac{N_<}{N}
\end{equation}

By law of large numbers, this number will converge to $p$ as $N \to \infty$. Hence, our estimation of $\pi$ is:

\begin{equation}
\hat \pi = 4p_< 
\end{equation}

**Tasks**

1. Generate $N$ pairs of $(X, Y)$, calculate for each $N$ how many of them are in unit circle $N<$. Choose $N$ so that you are able to see how $\hat \pi$ approaches $\pi$ by increasing $N$. (for example, use $N$ log-scaled)

2. Save data as array with informations: how many points have been used and estimation of pi.

3. Plot the data.


```python

```

9d7fc7787e1ffb357b78d7651b21a87d4b086352
ipynb
Jupyter Notebook
Monte Carlo/piTask.ipynb
PhyProg/RCT
07f02dca1bd5258b8a0a1d1d83a923ea33176161
MIT
Monte Carlo/piTask.ipynb
PhyProg/RCT
07f02dca1bd5258b8a0a1d1d83a923ea33176161
MIT
Monte Carlo/piTask.ipynb
PhyProg/RCT
07f02dca1bd5258b8a0a1d1d83a923ea33176161
MIT
Qwen/Qwen-72B
1. YES
2. YES