diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index 0ddaee4d6d8a5a96722e9d5c95bc93e9eee8f5e8..ddc6a8fc94482a2a02948986a8675baa4d171614 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -60,4 +60,10 @@ reject = np.logical_not(accept) fig, ax = plt.subplots(1) ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None) ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None) -ax.set_aspect('equal') \ No newline at end of file +ax.set_aspect('equal') + +Il est alors aisé d'obtenir une approximation (pas terrible) de $\pi$ en comptant combien de fois, en moyenne, $X^2 + Y^2$ est inférieur à 1 : + +In [4]: +4*np.mean(accept) +