1

Given

  • I have a $n$ dimensional $\vec{a}$.
  • All elements of $\vec{a}$ are between 0 and a positive number $K$.
  • $n$ is about 15 to 20.

Problem

I want to randomly and unbiasedly choose a vector $\vec{b}$ such that:

  • Elements of $\vec{b}$ are between 0 and 1.
  • $\vec{a} \cdot \vec{b} = 1$

How to do that?

Attempt

I thought about the following:

  • Choose $\vec{c}$, a random direction perpendicular to $\vec{b}$.
  • Find range of $\theta$ such that $\vec{b} = \frac{\vec{a}}{\lVert \vec{a} \rVert} + \theta\vec{c}$ is within bounds.
  • Randoly choose a $\theta$

The problem is that this is not unbiased. Some directions have a larger range of legal $\theta$, and those directions should be chosen more often.

R zu
  • 168
  • 10

1 Answers1

1

Uniformly sampling from a simplex with equation $\vec{a} \cdot \vec{b} = 1$, and reject samples out of bounds.

Several answers are posted here for uniform sampling over a simplex: Uniform sampling from a simplex

R zu
  • 168
  • 10