Adjusting the buffon example to print with the same precision as in the model document

parent 61bd7b7b
...@@ -53,14 +53,11 @@ ...@@ -53,14 +53,11 @@
}, },
"outputs": [ "outputs": [
{ {
"data": { "name": "stdout",
"text/plain": [ "output_type": "stream",
"3.128911138923655" "text": [
] "3.1289111389236548\n"
}, ]
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
} }
], ],
"source": [ "source": [
...@@ -69,7 +66,8 @@ ...@@ -69,7 +66,8 @@
"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",
"theta = np.random.uniform(size=N, low=0, high=pi/2)\n", "theta = np.random.uniform(size=N, low=0, high=pi/2)\n",
"2/(sum((x+np.sin(theta))>1)/N)" "approx = 2/(sum((x+np.sin(theta))>1)/N)\n",
"print(f\"{approx:.16f}\")"
] ]
}, },
{ {
......
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