01: Solve direct-sampling of dimension d sphere volumes

This commit is contained in:
2022-09-09 12:01:44 +02:00
parent 544636cfec
commit 417497e25f

View File

@ -519,13 +519,13 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"N = 10000 \td = 1 \tV_d = 2.000 \tdirect-sampled V_d = 1.000\n", "N = 10000 \td = 1 \tV_d = 2.000 \tdirect-sampled V_d = 2.000\n",
"N = 10000 \td = 2 \tV_d = 3.142 \tdirect-sampled V_d = 0.788\n", "N = 10000 \td = 2 \tV_d = 3.142 \tdirect-sampled V_d = 3.144\n",
"N = 10000 \td = 3 \tV_d = 4.189 \tdirect-sampled V_d = 0.530\n", "N = 10000 \td = 3 \tV_d = 4.189 \tdirect-sampled V_d = 4.161\n",
"N = 10000 \td = 4 \tV_d = 4.935 \tdirect-sampled V_d = 0.304\n", "N = 10000 \td = 4 \tV_d = 4.935 \tdirect-sampled V_d = 4.898\n",
"N = 10000 \td = 5 \tV_d = 5.264 \tdirect-sampled V_d = 0.165\n", "N = 10000 \td = 5 \tV_d = 5.264 \tdirect-sampled V_d = 5.357\n",
"N = 10000 \td = 6 \tV_d = 5.168 \tdirect-sampled V_d = 0.083\n", "N = 10000 \td = 6 \tV_d = 5.168 \tdirect-sampled V_d = 5.146\n",
"N = 10000 \td = 7 \tV_d = 4.725 \tdirect-sampled V_d = 0.039\n" "N = 10000 \td = 7 \tV_d = 4.725 \tdirect-sampled V_d = 4.659\n"
] ]
} }
], ],
@ -541,10 +541,8 @@
" print(\"N = {}\".format(N),\n", " print(\"N = {}\".format(N),\n",
" \"\\td = {}\".format(d),\n", " \"\\td = {}\".format(d),\n",
" \"\\tV_d = {:.3f}\".format(volume_d_ball(d)),\n", " \"\\tV_d = {:.3f}\".format(volume_d_ball(d)),\n",
" \"\\tdirect-sampled V_d = {:5.3f}\".format(number_of_hits_in_d_dimensions(N, d)/N)\n", " \"\\tdirect-sampled V_d = {:5.3f}\".format(number_of_hits_in_d_dimensions(N, d)/N*2**d)\n",
" )\n", " )"
"\n",
"# TODO: Results not yet as expected."
] ]
}, },
{ {