Integrate upper $n$-sphere

269 Views Asked by At

For a class on Monte-Carlo simulation methods I want to do a comparison of Monte-Carlo integration and numerical integration on sparse grids. For this purpose I need a function $f$ defined over the $n$-dimensional hypercube $[-1,1]^n$ of which I know the value of the integral $\int_{[-1,1]^n} f$ in order to compare the calculation errors of the different methods. I thought about integrating the unit $n$-sphere as this is defined over the hypercube and the exact volume of the unit $n$-sphere is given by

$$V_n=\frac{\pi^{\frac{n}{2}}}{\Gamma (\frac{n}{2} +1)}$$

Now integrating the whole $n$-sphere will result in the integral being 0 as it is symmetric. That's why I thought about using only the upper unit $n$-sphere. Then the value of the integral would be given by $V_n/2$. However, I did not manage to come up with a function describing this upper half of the $n$-sphere. In the 2-dimensional case the upper sphere $U_2$ would be given by $U_2=\left\{ x_2= \sqrt{1-x_1^2},x_2\geq 0\right\}$ or in the more general case of the unit $n$-ball $U_n=\left\{ \sqrt{1-\sum_{i=1}^{n-1}{x}_{i}^{2}},x_n\geq 0 \right\} $.

Is there a way to express $U_n$ as a function that I could plug into my implemented integration algorithms to integrate it over the $n$-dimensional hypercube?

1

There are 1 best solutions below

0
On BEST ANSWER

Why don't you try polynomials - the simplest of the non-trivial examples? Choose a degree $d \in \Bbb N$ and a set of coefficients $\{a_{i_1, \dots, i_n} \mid i_1 + \dots + i_n \le d\} \subset \Bbb C$ and consider the associated polynomial $p(x_1, \dots, x_n) = \sum _{i_1 + \dots + i_n \le d} a_{i_1, \dots, i_n} x_1 ^{i_1} \dots x_n ^{i_n}$. Then

$$\int \limits _{[-1,1]^n} p(x_1, \dots, x_n) \ \Bbb d x_1 \dots \Bbb d x_n = \int \limits _{-1} ^1 \dots \int \limits _{-1} ^1 \sum _{i_1 + \dots + i_n \le d} a_{i_1, \dots, i_n} x_1 ^{i_1} \dots x_n ^{i_n} \ \Bbb d x_1 \dots \Bbb d x_n = \\ \sum _{i_1 + \dots + i_n \le d} a_{i_1, \dots, i_n} \frac {1 + (-1)^{i_1}} {i_1 + 1} \dots \frac {1 + (-1)^{i_n}} {i_n + 1} ,$$

a formula simple enough to let you compare its value with the one that you obtain numerically.