Let us consider a hyper-cube whose length is *l* units along each of its d-dimensional structure. It is desired to uniformly sample a point inside the hyper-cube. How to do uniform sampling and what could be its probability?

Asked

Active

Viewed 955 times

0

hello world

- 261
- 3
- 12

## 2 Answers

1

Generate $d$ samples from the uniform distribution over $[0,l]$ and use them as coordinates in the hypercube.

joriki

- 215,929
- 14
- 263
- 474

1

To sample a point, just sample $d$ coordinates over the 1-dimensional domain $[0,l]$ and use them as coordinates for the sample point.

To figure out the probability, consider the fact that the integral over the entire probability space should equal 1, and that the probability distribution should be uniform (i.e. $\propto 1$). You can just integrate $1$ over the entire domain, and then normalize:

$$ \int_0^l\int_0^l\ldots\int_0^l p\cdot \mathrm d s_1\mathrm d s_2\ldots\mathrm ds_d = 1\\ \\ \Longrightarrow p = \frac{1}{l^d} $$

Tomas Aschan

- 435
- 3
- 13