2

Put it simply, how do I generate uniformly randomly a vector $w = (w_1,w_2,w_3)$ such that $w_1+w_2+w_3 = 1$ and $w_i\geq 0$ ? Essentially, I want the same thing as in Uniform distribution on the surface of unit sphere, except in the $L_1$ norm and also in the positive quadrant.

Note I need this for a simulation, so a direct reference to a python library would work. Also, I decided it's better to post it here after searching on stackoverflow - even the more natural $L^2$ norm version of the question was better answered here.

I am tempted to do the naive $X_1,X_2,X_3\sim Unif[0,1]$ i.i.d and then normalize by the $L^1$ norm, but the above answer for $L^2$ says this only works for $L^2$ if I do normal random variables, so I am a bit unsure.

dezdichado
  • 13,888
  • Generate $3$ random points in $[0,1]$, then divide by their sum. – Daniel P Jul 27 '23 at 19:33
  • @DanielP point me to a proof ? I would have though the same thing for the $L^2$ norm would work, but apparently it does not - you need a Gaussian for that - as shown in the link I linked. – dezdichado Jul 27 '23 at 19:36

1 Answers1

3

Generate $U_i\sim \texttt{Exp}(1)$ and let $$X_i \sim \frac{U_i}{\sum_{i=1}^n U_i}$$ then $$\left(X_1,\ldots,X_n\right)\sim \texttt{Uni}\left(\Delta\right)$$ where $\Delta := \left\{(x_1,...,x_n) \ | \ \sum\limits_{k=1}^{n} x_k =1 \right\}$.


You can find the justification of the statement in this paper

Kroki
  • 13,135