From 6f1132becbf46f40ae32a4aca5138d5ad6b51b85 Mon Sep 17 00:00:00 2001
From: 55c671948c2c802a48ec3ed371eaabea
<55c671948c2c802a48ec3ed371eaabea@app-learninglab.inria.fr>
Date: Thu, 30 Apr 2020 18:25:54 +0000
Subject: [PATCH] Update toy_document_orgmode_python_fr.org
---
module2/exo1/toy_document_orgmode_python_fr.org | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/module2/exo1/toy_document_orgmode_python_fr.org b/module2/exo1/toy_document_orgmode_python_fr.org
index da89a0a..96259ea 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)
--
2.18.1