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
8517fa92e97b3a318e653caefbfde6b5
mooc-rr
Commits
66314396
Commit
66314396
authored
Mar 31, 2020
by
8517fa92e97b3a318e653caefbfde6b5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.2
parent
a8e3a008
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
14 deletions
+49
-14
toy_notebook_fr.ipynb
module2/exo1/toy_notebook_fr.ipynb
+49
-14
No files found.
module2/exo1/toy_notebook_fr.ipynb
View file @
66314396
...
@@ -3,10 +3,12 @@
...
@@ -3,10 +3,12 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {
"metadata": {
"hideCode":
tru
e,
"hideCode":
fals
e,
"hidePrompt":
tru
e
"hidePrompt":
fals
e
},
},
"source": [
"source": [
"<p style=\"text-align:center\";>__toy\\_notebook\\_fr__</p>\n",
"\n",
"<p style=\"text-align:center\";>March 28, 2019</p>\n",
"<p style=\"text-align:center\";>March 28, 2019</p>\n",
"\n",
"\n",
"# propos du calcul de $\\pi$\n",
"# propos du calcul de $\\pi$\n",
...
@@ -20,46 +22,79 @@
...
@@ -20,46 +22,79 @@
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
"metadata": {
"metadata": {
"hideCode":
tru
e,
"hideCode":
fals
e,
"hidePrompt":
tru
e
"hidePrompt":
fals
e
},
},
"outputs": [],
"outputs": [],
"source": [
"source": [
"from math import *
\n",
"from math import *\n",
"print(pi)"
"print(pi)"
]
]
},
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {
"metadata": {
"hideCode":
tru
e,
"hideCode":
fals
e,
"hidePrompt":
tru
e
"hidePrompt":
fals
e
},
},
"source": [
"source": [
"## En utilisant la méthode des aiguilles de Buffon"
"## En utilisant la méthode des aiguilles de Buffon"
]
]
},
},
{
"cell_type": "markdown",
"metadata": {
"hideCode": false,
"hidePrompt": false
},
"source": [
"Mais calculé avec la méthode des , on obtiendrait comme __approximation__ :"
]
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
"metadata": {
"metadata": {
"hideCode":
tru
e,
"hideCode":
fals
e,
"hidePrompt":
tru
e
"hidePrompt":
fals
e
},
},
"outputs": [],
"outputs": [],
"source": []
"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",
"2/(sum((x+np.sin(theta))>1)/N)"
]
},
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": false,
"hidePrompt": true
"hideOutput": true,
"hidePrompt": false
},
},
"source": []
"source": [
"## Avec un argument \"fréquentiel\" de surface"
]
},
{
"cell_type": "markdown",
"metadata": {
"hideCode": false,
"hidePrompt": false
},
"source": [
"Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d’appel à la fonction sinus se base sur le fait que si\n",
"\n",
"\n",
"X\u0018U(0, 1)etY\u0018U(0, 1)alorsP[X2+Y2\u00141]=p/4 (voirméthode de Monte Carlo sur Wikipedia). Le code suivant illustre ce fait :"
]
}
}
],
],
"metadata": {
"metadata": {
"hide_code_all_hidden":
tru
e,
"hide_code_all_hidden":
fals
e,
"kernelspec": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3",
"language": "python",
"language": "python",
...
...
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