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
3647d0b8ed16292ade589331f0d6145a
mooc-rr
Commits
827a6eb4
Commit
827a6eb4
authored
Dec 10, 2020
by
3647d0b8ed16292ade589331f0d6145a
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test2
parent
628c6c5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
31 deletions
+47
-31
toy_notebook_fr.ipynb
module2/exo1/toy_notebook_fr.ipynb
+47
-31
No files found.
module2/exo1/toy_notebook_fr.ipynb
View file @
827a6eb4
...
@@ -20,34 +20,33 @@
...
@@ -20,34 +20,33 @@
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": [
"source": [
"#
# A propos du calcul de *π*
"
"#
À propos du calcul de $\\pi$
"
]
]
},
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": [
"source": [
"##
#
En demandant à la lib maths\n",
"## En demandant à la lib maths\n",
"Mon ordinateur m'indique que
*π*
vaut *approximativement*"
"Mon ordinateur m'indique que
$\\pi$
vaut *approximativement*"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
4
,
"execution_count":
5
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"ename": "SyntaxError",
"name": "stdout",
"evalue": "invalid syntax (<ipython-input-4-4ac309e0cc7a>, line 1)",
"output_type": "stream",
"output_type": "error",
"text": [
"traceback": [
"3.141592653589793\n"
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-4-4ac309e0cc7a>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m In[1] : from $\\math$ import *\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
]
}
}
],
],
"source": [
"source": [
"
In[1] : from $\\math$
import *\n",
"
from math
import *\n",
"
'print(pi)'
"
"
print(pi)
"
]
]
},
},
{
{
...
@@ -60,20 +59,24 @@
...
@@ -60,20 +59,24 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
2
,
"execution_count":
6
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"ename": "
Syntax
Error",
"ename": "
Type
Error",
"evalue": "
invalid syntax (<ipython-input-2-e0eb810442a1>, line 1)
",
"evalue": "
seed() got an unexpected keyword argument 'see'
",
"output_type": "error",
"output_type": "error",
"traceback": [
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-2-e0eb810442a1>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m In[2]:import numpy as np\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-6-bea296134fd7>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mseed\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msee\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mN\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10000\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0muniform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mN\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlow\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhigh\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mtheta\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0muniform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mN\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlow\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhigh\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpi\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32mmtrand.pyx\u001b[0m in \u001b[0;36mmtrand.RandomState.seed\u001b[0;34m()\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: seed() got an unexpected keyword argument 'see'"
]
]
}
}
],
],
"source": [
"source": [
"
In[2]:
import numpy as np\n",
"import numpy as np\n",
"np.random.seed(see=42)\n",
"np.random.seed(see=42)\n",
"N=10000\n",
"N=10000\n",
"x - np.random.uniform(size=N, low=0, high=1)\n",
"x - np.random.uniform(size=N, low=0, high=1)\n",
...
@@ -91,17 +94,17 @@
...
@@ -91,17 +94,17 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
null
,
"execution_count":
7
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"
in[3]
%matplotlib inline\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
null
,
"execution_count":
8
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -115,9 +118,18 @@
...
@@ -115,9 +118,18 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
null
,
"execution_count":
9
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "SyntaxError",
"evalue": "positional argument follows keyword argument (<ipython-input-9-9f56e3d7a142>, line 2)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-9-9f56e3d7a142>\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m ax.scatter(x[accept], y[accept], c='b', alpha=0,2, edgecolor=None)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m positional argument follows keyword argument\n"
]
}
],
"source": [
"source": [
"fig, ax=plt.subplots(1)\n",
"fig, ax=plt.subplots(1)\n",
"ax.scatter(x[accept], y[accept], c='b', alpha=0,2, edgecolor=None)\n",
"ax.scatter(x[accept], y[accept], c='b', alpha=0,2, edgecolor=None)\n",
...
@@ -134,19 +146,23 @@
...
@@ -134,19 +146,23 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
null
,
"execution_count":
10
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"3.112"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"source": [
"
In [4]
4*np.mean(accept)"
"4*np.mean(accept)"
]
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
}
],
],
"metadata": {
"metadata": {
...
...
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