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
98f2ed4439575d81664e713d5d166675
mooc-rr
Commits
b9d3e5f0
Commit
b9d3e5f0
authored
Aug 08, 2025
by
98f2ed4439575d81664e713d5d166675
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cells for notebook exercise
parent
8bfadd23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
1 deletion
+73
-1
toy_notebook_en.ipynb
module2/exo1/toy_notebook_en.ipynb
+73
-1
No files found.
module2/exo1/toy_notebook_en.ipynb
View file @
b9d3e5f0
{
{
"cells": [],
"cells": ["cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# À propos de pi"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Some mathematical formulas:\n",
"$\\pi = \\frac{C}{D}$\n",
"$$ \\pi \\approx 3.14 $$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"print(math.pi)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Learn more here: [Aiguilles de Buffon](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"import math\n\n",
"def buffon_needle(n):\n",
" count = 0\n",
" for _ in range(n):\n",
" x = random.uniform(0, 1)\n",
" theta = random.uniform(0, math.pi / 2)\n",
" if x <= math.sin(theta):\n",
" count += 1\n",
" return (2 * n) / count\n\n",
"print(buffon_needle(100000))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n\n",
"x = np.linspace(0, 2 * np.pi, 100)\n",
"y = np.sin(x)\n\n",
"plt.plot(x, y)\n",
"plt.title(\"Sine Wave\")\n",
"plt.xlabel(\"x\")\n",
"plt.ylabel(\"sin(x)\")\n",
"plt.grid(True)\n",
"plt.show()"
]
}
]
],
"metadata": {
"metadata": {
"kernelspec": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3",
...
...
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