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
d7c7db59c0b2f422c65ebb1d22a0db91
mooc-rr
Commits
827e35dc
Commit
827e35dc
authored
May 10, 2020
by
Elias Bouacida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Premier document org
parent
310b68dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
toy_document_orgmode_python_fr.org
module2/exo1/toy_document_orgmode_python_fr.org
+12
-5
No files found.
module2/exo1/toy_document_orgmode_python_fr.org
View file @
827e35dc
...
@@ -15,20 +15,21 @@
...
@@ -15,20 +15,21 @@
Mon ordinateur indique que \pi vaut /approximativement/:
Mon ordinateur indique que \pi vaut /approximativement/:
#+begin_src python :results output :exports both
#+begin_src python :results output :
session :
exports both
from math import *
from math import *
pi
pi
#+end_src
#+end_src
#+RESULTS:
#+RESULTS:
: 3.141592653589793
: Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32
: Type "help", "copyright", "credits" or "license" for more information.
* En utilisant la méthode des aiguilles de Buffon
* En utilisant la méthode des aiguilles de Buffon
Mais calculé avec la *méthode* des [[https://fr.wikipedia.org/wiki/Aiguille_de_Buffon][aiguilles de Buffon]], on obtiendrait
Mais calculé avec la *méthode* des [[https://fr.wikipedia.org/wiki/Aiguille_de_Buffon][aiguilles de Buffon]], on obtiendrait
comme *approximation* :
comme *approximation* :
#+begin_src python :results output :exports both
#+begin_src python :results output :
session :
exports both
import numpy as np
import numpy as np
np.random.seed(seed=42)
np.random.seed(seed=42)
N = 10000
N = 10000
...
@@ -38,7 +39,6 @@ theta = np.random.uniform(size=N, low=0, high=pi/2)
...
@@ -38,7 +39,6 @@ theta = np.random.uniform(size=N, low=0, high=pi/2)
#+end_src
#+end_src
#+RESULTS:
#+RESULTS:
: 3.128911138923655
* Avec un argument "fréquentiel" de surface
* Avec un argument "fréquentiel" de surface
...
@@ -48,7 +48,7 @@ X∼U(0,1) et Y∼U(0,1) alors P[X^2+Y^2≤1]=π/4 (voir
...
@@ -48,7 +48,7 @@ X∼U(0,1) et Y∼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]]).
[[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 :
Le code suivant illustre ce fait :
#+begin_src python :results output
:session
:exports both
#+begin_src python :results output
file :session :var matplot_lib_filename="./figure_pi_mc2.png"
:exports both
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
np.random.seed(seed=42)
np.random.seed(seed=42)
...
@@ -68,6 +68,13 @@ plt.savefig(matplot_lib_filename)
...
@@ -68,6 +68,13 @@ plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+end_src
#+RESULTS:
[[file:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:/Users/bouac/AppData/Local/Temp/babel-3bK4It/python-AEJboM", line 4, in <module>
np.random.seed(seed=42)
NameError: name 'np' is not defined]]
#+begin_src python :results output :session :exports both
#+begin_src python :results output :session :exports both
4*np.mean(accept)
4*np.mean(accept)
#+end_src
#+end_src
...
...
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