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
1d4d963b85e35089e12657e52047b222
mooc-rr
Commits
b91aa8da
Commit
b91aa8da
authored
Sep 25, 2024
by
1d4d963b85e35089e12657e52047b222
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update toy_notebook_fr.ipynb
parent
e4faf466
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
toy_notebook_fr.ipynb
module2/exo1/toy_notebook_fr.ipynb
+7
-1
No files found.
module2/exo1/toy_notebook_fr.ipynb
View file @
b91aa8da
...
@@ -60,4 +60,10 @@ reject = np.logical_not(accept)
...
@@ -60,4 +60,10 @@ reject = np.logical_not(accept)
fig, ax = plt.subplots(1)
fig, ax = plt.subplots(1)
ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)
ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)
ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)
ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)
ax.set_aspect('equal')
ax.set_aspect('equal')
\ No newline at end of file
Il est alors aisé d'obtenir une approximation (pas terrible) de $\pi$ en comptant combien de fois, en moyenne, $X^2 + Y^2$ est inférieur à 1 :
In [4]:
4*np.mean(accept)
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