Is there an algorithm better than rejecting sampling for sampling from an inscribed circle?

49 Views Asked by At

Let $\mathcal{H} = \{x \in \mathbb{R}^n | \sum_{i = 1}^n x = 1\}$ and $\mathcal{D} = \{x\in \mathbb{R}^n| \|x\|^2 = 1\}$

I wish to uniformly generate point from $\mathcal{S} = \mathcal{H} \cap \mathcal{D}$.

In lower dimensions $n \leq 2$ this question is quite easy, but I am not sure exactly how to implement an algorithm that samples uniformly from this set in higher dimension aside from trying to first generate a point on the circle, then reject the ones whose coordinates do not sum up to $1$.

Does anyone have any good idea how to deal with this?

1

There are 1 best solutions below

0
On BEST ANSWER

Let $\mathbf{1}=(1,\ldots,1)$ be the all-ones vector.

Any vector $\mathbf{x}$ in $\mathbb{R}^n$ has a unique decomposition as $$\mathbf{x}=a\mathbf{1} + b\mathbf{u} \qquad \text{where $\mathbf{u}^\top \mathbf{1}=0$, $\|\mathbf{u}\|=1$, $a \in \mathbb{R}$, and $b \ge 0$}.$$ We then have $$\sum_{i=1}^n x_i = \mathbf{x}^\top \mathbf{1} = an$$ and $$\|\mathbf{x}\|^2 = a^2 \sqrt{n} + b^2.$$ If $\mathbf{x} \in \mathcal{S}$, we then must have $a=\frac{1}{n}$ and $b = \sqrt{\frac{n-1}{n}}$.

Thus, $$\mathcal{S} = \left\{\frac{1}{n}\mathbf{1} + \sqrt{\frac{n-1}{n}} \mathbf{u}: \|\mathbf{u}\|=1, \mathbf{u}^\top \mathbf{1}=0\right\}.$$ Your problem then reduces to [uniformly?] sampling unit vectors from the hyperplane $\{\mathbf{u} : \mathbf{u}^\top \mathbf{1} = 0\}$.

(I guess one can achieve the last step by extending $\mathbf{1}$ to an orthonormal basis $\mathbf{1}, \mathbf{v}_2, \ldots, \mathbf{v}_n$ of $\mathbb{R}^n$, and then sample the coefficients $c_2, \ldots, c_n$ of the added $n-1$ basis vectors from the unit circle in $\mathbb{R}^{n-1}$ to arrive at $\mathbf{u} := c_2 \mathbf{v}_2 + \cdots + c_n \mathbf{v}_n$. There may be cleverer ways to do this.)