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
a49c585c4fe7205185de4c52fe2e58c3
mooc-rr
Commits
2de543b1
Commit
2de543b1
authored
Nov 02, 2025
by
a49c585c4fe7205185de4c52fe2e58c3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no commit message
parent
2af918f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
toy_notebook_fr.ipynb
module2/exo1/toy_notebook_fr.ipynb
+16
-4
No files found.
module2/exo1/toy_notebook_fr.ipynb
View file @
2de543b1
{
"cells": [
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"## Méthode des aiguilles de Buffon\n",
"import random\n",
"import math\n",
"\n",
"Pour en savoir plus : \n",
"[Expérience des aiguilles de Buffon (Wikipedia)](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon)"
"def buffon_needle(n_drops=100000):\n",
" hits = 0\n",
" for _ in range(n_drops):\n",
" y = random.random()\n",
" theta = random.uniform(0, math.pi / 2)\n",
" if y <= (math.sin(theta) / 2):\n",
" hits += 1\n",
" return (2 * n_drops) / hits\n",
"\n",
"pi_est = buffon_needle()\n",
"print(f\"Estimation de π par la méthode de Buffon : {pi_est}\")\n"
]
}
],
...
...
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