Commit 1c7f4349 authored by Firmin's avatar Firmin

Fir commit

parent 8c35791b
...@@ -105,6 +105,33 @@ ...@@ -105,6 +105,33 @@
"ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n", "ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n",
"ax.set_aspect('equal')" "ax.set_aspect('equal')"
] ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It is then straight forward to obtain a (not really good) approximation to $\\pi$ by counting how many times, on average, $X^2$ + $Y^2$ is smaller than 1:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.112"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4*np.mean(accept)"
]
} }
], ],
"metadata": { "metadata": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment