1
$\begingroup$

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=\{ x_2= \sqrt{1-x_1^2},x_2\geq 0\}$ or in the more general case of the unit $n$-ball $U_n = \{ \sqrt{1- \sum_{i=1}^{n-1} x_i^2 }, x_n \geq 0 \}$.

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
    The assertion "[the unit $n$-sphere] is defined over the hypercube..." is not true if $n \geq 2$. (The "shadow" of an ordinary hemisphere is a disk, not a square.) Separately, it's not clear what you mean by "integrating the whole $n$-sphere will result in the integral being $0$ as it is symmetric".2017-01-19
  • 0
    So on which set is the unit $n$-sphere defined?2017-01-19
  • 1
    I think you want: The unit sphere is the union of two graphs $x_{n+1} = \pm\sqrt{1 - \|x\|^{2}}$ over the _unit ball_, the set of $x = (x_{1}, \dots, x_{n})$ in $\mathbf{R}^{n}$ where $\|x\|^{2} \leq 1$.2017-01-19
  • 0
    @YukiJ: Offering a bounty but not awarding it is like making a promise but not keeping it: a very ugly kind of behaviour.2017-01-28
  • 0
    I am sorry @AlexM. But I Received an e-mail that the bounty will be automatically given to the best answer? Why has this not happened?!2017-01-28
  • 0
    @YukiJ: From http://math.stackexchange.com/help/bounty: *"If you do not award your bounty within 7 days (plus the grace period), the highest voted answer created after the bounty started with a minimum score of 2 will be awarded half the bounty amount (or the full amount, if the answer is also accepted). If two or more eligible answers have the same score (their scores are tied), the oldest answer is chosen. If there's no answer meeting those criteria, no bounty is awarded to anyone."* Since the only answer had less than 2 votes and it was not accepted, no bounty got awarded.2017-01-28

1 Answers 1

2

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.