$x_1^2+x_2^2+x_3^2+...x_{10}^2 \leq1$ Do I use the Mathematica QuasiMonteCarlo method wrongley?

77 Views Asked by At

I want to find the volume of the multisphere restricted by $x_1^2+x_2^2+x_3^2+...x_{10}^2 \leq1$, by using NIngtegrate and the QuasiMonteCarlo method.

I start with dim = 10 with the expression

Clear[f, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10];

f[x1_, x2_, x3_, x4_, x5_, x6_, x7_, x8_, x9_, x10_] = 
  x1^2 + x2^2 + x3^2 + x4^2 + x5^2 + x6^2 + x7^2 + x8^2 + x9^2 + x10^2 <= 1;

NIntegrate[
 Boole[f[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10]], {x1, -1, 1},
   {x2, -1, 1}, {x3, -1, 1}, {x4, -1, 1}, {x5, -1, 1}, {x6, -1, 1}, 
   {x7, -1, 1}, {x8, -1, 1}, {x9, -1, 1}, {x10, -1, 1}, 
   Method -> "QuasiMonteCarlo"]

During evaluation of In[251]:= NIntegrate::maxp: The integral failed to converge after 50000 integrand evaluations. NIntegrate obtained 79.34031316594088and 1.317599927131093 for the integral and error estimates.

Out[253]= 79.3403

The result does not convince me. So I try another method by randomly generating and adding points etc.

Clear[n, dim, reg1, points, vol, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10];

reg1[{x1_, x2_, x3_, x4_, x5_, x6_, x7_, x8_, x9_, x10_}] = 
  x1^2 + x2^2 + x3^2 + x4^2 + x5^2 + x6^2 + x7^2 + x8^2 + x9^2 + x10^2 <= 1;

n = 100000;
dim = 10;
points = Sum[Boole[test1[RandomReal[{-1, 1}, dim]]], {i, 1, n}];
vol = points*2^dim/n // N

Out[273]= 2.59072

This result is more in line with the accurate answer $\frac{\pi ^5}{120}$.

Where do I go wrong?