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
hakimouaras
mooc-rr
Commits
a9236df9
Commit
a9236df9
authored
Apr 20, 2020
by
hakimouaras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrections
parent
6e9c9781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
toy_notebook_fr.ipynb
module2/exo1/toy_notebook_fr.ipynb
+24
-24
No files found.
module2/exo1/toy_notebook_fr.ipynb
View file @
a9236df9
...
...
@@ -18,26 +18,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#
#
À propos du calcul de $\\pi$ "
"# À propos du calcul de $\\pi$ "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##
#
En demandant à la lib maths"
"## En demandant à la lib maths"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Mon ordinateur m’indique que $\\pi$ vaut
approximativement
"
"Mon ordinateur m’indique que $\\pi$ vaut
*approximativement*
"
]
},
{
"cell_type": "code",
"execution_count":
5
,
"execution_count":
9
,
"metadata": {},
"outputs": [
{
...
...
@@ -49,7 +49,7 @@
}
],
"source": [
"from math import *
\n",
"from math import *\n",
"print(pi)"
]
},
...
...
@@ -57,7 +57,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"##
#
En utilisant la méthode des aiguilles de Buffon "
"## En utilisant la méthode des aiguilles de Buffon "
]
},
{
...
...
@@ -69,7 +69,7 @@
},
{
"cell_type": "code",
"execution_count":
6
,
"execution_count":
10
,
"metadata": {
"scrolled": true
},
...
...
@@ -80,17 +80,17 @@
"3.128911138923655"
]
},
"execution_count":
6
,
"execution_count":
10
,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np
\n",
"np.random.seed(seed=42)
\n",
"N = 10000
\n",
"x = np.random.uniform(size=N, low=0, high=1)
\n",
"theta = np.random.uniform(size=N, low=0, high=pi/2)
\n",
"import numpy as np\n",
"np.random.seed(seed=42)\n",
"N = 10000\n",
"x = np.random.uniform(size=N, low=0, high=1)\n",
"theta = np.random.uniform(size=N, low=0, high=pi/2)\n",
"2/(sum((x+np.sin(theta))>1)/N)"
]
},
...
...
@@ -98,7 +98,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"##
#
Avec un argument \"fréquentiel\" de surface "
"## Avec un argument \"fréquentiel\" de surface "
]
},
{
...
...
@@ -113,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count":
7
,
"execution_count":
11
,
"metadata": {},
"outputs": [
{
...
...
@@ -130,19 +130,19 @@
}
],
"source": [
"%matplotlib inline
\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"\n",
"np.random.seed(seed=42)
\n",
"N = 1000
\n",
"x = np.random.uniform(size=N, low=0, high=1)
\n",
"np.random.seed(seed=42)\n",
"N = 1000\n",
"x = np.random.uniform(size=N, low=0, high=1)\n",
"y = np.random.uniform(size=N, low=0, high=1)\n",
"accept = (x*x+y*y) <= 1
\n",
"accept = (x*x+y*y) <= 1\n",
"reject = np.logical_not(accept)\n",
"\n",
"fig, ax = plt.subplots(1) \n",
"ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)
\n",
"ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)
\n",
"ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)\n",
"ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n",
"ax.set_aspect('equal')"
]
},
...
...
@@ -156,7 +156,7 @@
},
{
"cell_type": "code",
"execution_count":
8
,
"execution_count":
12
,
"metadata": {
"scrolled": true
},
...
...
@@ -167,7 +167,7 @@
"3.112"
]
},
"execution_count":
8
,
"execution_count":
12
,
"metadata": {},
"output_type": "execute_result"
}
...
...
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