diff --git a/module2/exo1/toy_document_orgmode_python_fr.org b/module2/exo1/toy_document_orgmode_python_fr.org index da89a0ac62b7881e36c65093211633debb987afc..96259ea7c48e2e6e81ec5045c76edee94b977255 100644 --- a/module2/exo1/toy_document_orgmode_python_fr.org +++ b/module2/exo1/toy_document_orgmode_python_fr.org @@ -5,15 +5,13 @@ #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: - #+HTML_HEAD: #+HTML_HEAD: #+PROPERTY: header-args :session :exports both - * En demandant à la lib maths -Mon ordinateur m'indique que $\pi$ vaut /approximativement/ +Mon ordinateur m'indique que $\pi$ vaut /approximativement/: #+begin_src python :results value :session *python* :exports both from math import * @@ -30,7 +28,7 @@ comme *approximation* : #+begin_src python :results value :session *python* :exports both import numpy as np np.random.seed(seed=42) -N = 100000 +N = 10000 x = np.random.uniform(size=N, low=0, high=1) theta = np.random.uniform(size=N, low=0, high=pi/2) 2/(sum((x+np.sin(theta))>1)/N) @@ -46,7 +44,6 @@ U(0,1)$ et $Y\sim U(0,1)$ alors $P[X^2+Y^2\leq 1] = \pi/4$ (voir [[https://fr.wi Monte Carlo sur Wikipedia]]). Le code suivant illustre ce fait : #+begin_src python :results output file :var matplot_lib_filename="figure_pi_mc2.png" :exports both :session *python* - import matplotlib.pyplot as plt np.random.seed(seed=42)