Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cbc8df4b3e42c59d0563af900ad5ff0f
mooc-rr
Commits
e8897524
Commit
e8897524
authored
Apr 14, 2020
by
antoine_moniot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add change to show the figure.
parent
e6c4f5c8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
toy_document_orgmode_python_fr.org
module2/exo1/toy_document_orgmode_python_fr.org
+5
-2
No files found.
module2/exo1/toy_document_orgmode_python_fr.org
View file @
e8897524
...
...
@@ -11,6 +11,8 @@
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/lib/js/jquery.stickytableheaders.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
#+TOC: headlines 1
* En demandant à lib maths
Mon ordinateur m'indique que π vaut /approximativement/:
...
...
@@ -47,7 +49,7 @@ intervenir d'appel à la fonction sinus se base sur le fait que si
$X \sim U(0, 1)$ et $Y \sim U(0, 1)$ alors $P[X^2 + Y^2 ≤ 1] = π/4$ (voir [[https://fr.wikipedia.org/wiki/M%C3%A9thode_de_Monte-Carlo#D%C3%A9termination_de_la_valeur_de_%CF%80][méthode
de Monte Carlo sur Wikipedia]]). Le code suivant illustre ce fait :
#+begin_src python :results file :session :var matplot_lib_filename="./figure.png" :exports both
#+begin_src python :results
output
file :session :var matplot_lib_filename="./figure.png" :exports both
import matplotlib.pyplot as plt
np.random.seed(seed=42)
...
...
@@ -68,7 +70,8 @@ print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:<matplotlib.collections.PathCollection object at 0x7f337d1964f0>]]
[[file:./figure.png]]
Il est alors aisé d'obtenir une approximation (pas terrible) de π en
comptant combien de fois, en moyenne, $X^2 + Y^2$ est inférieur à $1$ :
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment