From 496f580a80f5db0d419b55e884462c981605497f Mon Sep 17 00:00:00 2001 From: Dorinel Bastide Date: Tue, 7 Jul 2020 22:52:38 +0200 Subject: [PATCH] Final minor changes, managed to obtained indeed solution results as per questions --- module2/exo1/toy_document_orgmode_python_en.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module2/exo1/toy_document_orgmode_python_en.org b/module2/exo1/toy_document_orgmode_python_en.org index 5e6d2ae..841c4e9 100644 --- a/module2/exo1/toy_document_orgmode_python_en.org +++ b/module2/exo1/toy_document_orgmode_python_en.org @@ -44,6 +44,7 @@ A method that is easier to understand and does not make use of the $\sin$ functi import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt + np.random.seed(seed=42) N = 1000 x = np.random.uniform(size=N, low=0, high=1) @@ -69,7 +70,6 @@ C:/Users/Utilisateur/mooc-rr/module2/exo1/PictureRes.png]] It is then straightforward to obtain a (not really good) approximation to $\pi$ by counting how many times, on average, $X^2 + Y^2$ is smaller than 1: #+begin_src python :results output :session *python* :exports both -import numpy as np 4*np.mean(accept) #+end_src -- 2.18.1