I'm trying to compute 10-dimensional volume of a 9-sphere with radius r using Monte Carlo.
r = 1000
F = Piecewise[{{1, Sum[x[i]^2, {i, 10}] <= r}}, 0]
NIntegrate[F, {x[1], -1000, 1000}, {x[2], -1000, 1000}, {x[3], -1000, 1000}, {x[4], -1000, 1000}, {x[5], -1000, 1000}, {x[6], -1000, 1000}, {x[7], -1000, 1000}, {x[8], -1000, 1000}, {x[9], -1000, 1000}, {x[10], -1000, 1000}, Method -> {"MonteCarloRule", "Points" -> 1000000}]
But the results always off by the factor of 1e(P/2), where 1eP = The correct factoring. I'm wondering where did I do wrong?
Also I want to clean up the code
NIntegrate[F, {x[1], -1000, 1000}, {x[2], -1000, 1000}, {x[3], -1000, 1000}, {x[4], -1000, 1000}, {x[5], -1000, 1000}, {x[6], -1000, 1000}, {x[7], -1000, 1000}, {x[8], -1000, 1000}, {x[9], -1000, 1000}, {x[10], -1000, 1000}, Method -> {"MonteCarloRule", "Points" -> 1000000}]
I try to do this
NIntegrate[F, Table[{x[i], -r, r}, {i, 10}], Method -> {"MonteCarloRule", "Points" -> 1000000}]
But it doesn't work as Table[] gives list. I need to make it into sequence somehow. But trying to apply Sequence[] to Table[] still give me a list. Is there anyway to get around this?