Rev.u.,.ta.
VoL
Colomb.w.na.
XXI
(l9B?),
de. Ma.t.e.mau.cao
pag-6.187-200
GENERATING UNIFORMLY DISTRIBUTED POINTS
IN A SPHERE OF NORM il II p IN Rn
by
•
Stefan Corneliu STEFANESCU and Virgil CRAIU
Summary:
In this paper an efficient algorithm is given
for generating uniformll distributed points in a sphere in
the space JRn with norm I II p' A way is suggested for generating ~niformly distributed
points in a general sphere of norm
(C). or in the intersection of such domains in JR~. and
uni~ormly distributed points on the surface of the Euclidean
norm sphere or in a bounded domain of Rn. The classical results are obtained as particular cases.
II
Let Rn
§l. Introduction.
p
>
O. we consider
the n-dimensional
real space. For
the norm
( 1)
and the sphere S(n.p)
S(n.p)
{(xl.xZ
•...• x)
DEFINITION
Lr~mllj
di~~~ibu~e.d
n
1.
Ix. 1
E
R. l~i~n.
II(x1,xZ.···,x
The random vector
)11 < u.
n p
(2)
(x , ,X~,
... ,Xn ) is u.ru'..L.
over the domain D eRn.
D bounded.
of
187
nonzero volume
(vol.(D) ~ 0) if it has the density
Ivol (D) ,
1
g (x 1 ' x Z '...,xn)
=
function
( 3)
for
.
{
0,
otherwlse
where
(4)
vol (D)
EXPS(p)-di~t~ibuted (p-th o~de~ 6ymmet~iQal exponential di~t~ibution) if
2. The random variable
DEFINITION
it has the following
f(x)
density
•
[l/(Z.pl/p-l
=
E is
function
f(l/p)]
exp(-lxIP/p)
(5)
where
00
f
.
f(a)
t
a-l
a
exp(-t)dt
>
O.
(6)
o
3. The random
DEFINITION
E is EXPN(p)-di~t~i-
variable
buted (p-th n~de~ non ~ymmet~iQal exponential di~t~ibution)
I
if it has the following
density
function
__{[l/(pl/P-lf(l/P)]exp(-XP/P),
f(x)
o ,
(7)
otherwise.
4. The random variable
DEFINITION
for x>O
G is gamma di6t~i-
bated with ~hape pa~amete~ a, a > a if it has the following
density
function
f (x)
[xa-1exP(-X)]/f(a),
=
{
a ,
bution with mean 0 and variance
188
(8 )
otherwise.
REMARK 1. Random variables
bles. The exponential
for x > 0
having
the normal distri-
1 are EXPS(Z)-Tandom
random variables
varia-
may be regarded
as
EXPN(l)-random
variables
or as gamma
random variables
shape parameter 1.
We shall formulate an algorithm for generating
formly distributed points over the domain S(n,p).
§2.
Theoretical
with
uni-
results.
THEOREM 1. 16 Y"Yz, .. "Yn'Yn+1
a~e ~ndependen~ ~andom va~~abte~, Y1,YZ •... 'Yn have EXPS(p) d~~~~~bu~~on'Yn+'
ha~ ~he den~~~y 6unet~on
if
Y > 0
(9)
and
xi
=
Y i /(/Y 1 IP+IY Z·/P+ ..+IY n IP+yP n+l )l/p.• l~i:i;n,
then the ~andom
vecto~
bu~ed ove~ ~he doma~n
(X1,XZ'" .,Xn) ~c un~6o~mty
d~~~~~-
S(n,p).
For any Yn+l
Proof.
(10)
>
0 (Yn+l
E
R+), the transforma"
tion
(11 )
is one to one between RllxR+ and S(n,p)xR+.
From
(11).
we
obtain
y.
1
(1Z)
Let J '" D(yl.YZ' ... 'Yn'yn+1)/D(xl.xZ'
determinant
of the matrix
.... xn.xn+l)
(ay.;/ax.)
l'
"
J
""l,J",n
L
+1
be the
J
From
(12),
=
detCCily./ax')l
1
..
,J~n+
]
(13)
,)
~1
we obtain
(14 )
where
~ ...
= sign (xi) IxiIP-',
di
and
of the
first
real
column
number
x.
... ~ ..
o
0
0
d,
dZ
d3
1 ~i~n,
Expanding
we obtain
:
the
::: ...
~ ...
.. .
1
the
following
w /
being
determinant
recurrence
(15)
xn
dn
sign (x)
:;)
the
(15)
sign
by the
relationship
(16 )
+
where
A
A
the
190
I xli p-'
det(A)
is the matrix
1
a
a
0
a
a
a
a
0
1
a
0
0
0
From
.
(-1) n+Z slgn(x,)
..
row
e
.............................
oo
X
z
x3
(17)
0
a
1
0
0
a
0
a
1
A one
xl
...............
a
the matrix
first
0-"
a
~-1
xn
can
obtain
a diagonal
to the
last
place.
Therefore
det(A)
=
(-1)
n-l
xl
matrix
by moving
( 18)
and hence the relation
(16) may be written
By n sequencial applications
and (15) we obtain
J
of equality
in the form
(19) and from
(14)
= xnn+1 (1 -I x 1 I p - I x Z I P .....-I x n I p) 1/p -1.
(ZO)
The random variables Y1 .YZ"· "Yn'Yn+1
being independent,
it follows that the random vector (Y1'YZ,···,Y,Yn n+ 1) has
the density function
rTf= exp(_y!?/P)]/[zp1/P-1r(1/p)]n,
Lj 1
]
if Yn+l >
(Zl)
0 ;
Let (Xl .XZ•· ..•Xn.Xn+1) be the random vector obtained from
the random vector (yl.YZ •...• Yn,Yn+l) by the transformation
If gX(x1.xZ'oo
(11).
the random
vector
gx(x1.·:·.xn,xn+1)
.• xn.xn+1)
is the density
(Xl.XZ •...• Xn.Xn+l)'
function
of
then
= IJ!gY(y'(xl'···'xn+l)····'Yn+l(x1'···'xn+l))
(22)
where
the Jacobian
J of the transformation
(ZO). Now from (lZ) it follows
(11)
is given
by
that
[X~:~-lexp(-~+1 /p]/[ Zp1/p-lr(1/P)] n
if xn+1> O. (x1.xZ.-..,xn)e:: S(n.p) ;
o ,
(23)
otherwise.
If g(x1 ,xZ.- ..• xn) is the density function
vector (X l'X 2' - ..• Xn) given by (10). then
of the random
19]
00
constant
which
proves
(Z4)
the theorem.
REMARK 2. Making the substitution
integral (Z4) we obtain
t
X~+l/P
in the
[pnf(n/p+l)]/[2f(1/p)]n= l/vol(S(n,p)).
COROLLARY
1. (Stefilnescu [12]).16
alte ../..rtdepertdert,t
n.and om v an cab Le:s , Z"
1
1
mal
the
di..4tlti..but../..on
with
dert4ity
6urtetiort
meart
a
and
~
Zl,ZZ"",Zn,Zn+1
i ~n, havi..rtg a rtolt-
valt../..artce1, artd Zn+l having
z exp ( -z Z/2) ,
i.f z > 0;
fez)
{
0,
if z
<
a ;
and
X,
1
then
the
buted
=
Z l'
/
(Z 21+ Z22+ ... +ZnZ+ ZZ ) 1/Z
n+ 1
'
Itandom
../..rt
the
6phelte
The proof
Theorem
§3.
1 for p
Generating
obtained
take
S(n,Z)
algorithm.
192
results
from Remark
value6
1.
Since
the density
function
from the density
function
16 W i..6 a di..4cltete Itandom
-1
E ../..4
a EXPN{pJ-di..6tltibuted
EXPS{p)
norm).
1 and
= 2.
by symmetry
the
(of Euclidean
of this statement
PROPOSITION
may
(X1,XZ'" .,Xn) ../..6
un../..6oltmly di4tlti-
vectolt
(7),
(5)
is
we have:
valtiable
that
artd 1 each with pltobabi..li..ty 1/2 artd
Itartdom valti..able then W.E ../..6 a
di..4tlti..buted Itartdom valtiable.
REMARK 3. This proposition
generation
can be used for computer
of EXPS(p) random variables
starting
from
EXPN(p) random variables. Stef~nescu and Vaduva [13] (extending the method suggest by Kinderman and Monahan [5],
[6])
indicate efficient
algorithms
for generating
EXPN(p)
random variables.
The EXPN(p)
PROPOSITION
~hape pa~amete~
random variables
may be generated
using:
2. 16 G i~ a gamma ~andom va~iabie with
lip then the ~andom va~iabie (p.G) lip i~
EXPN(p) di~t~ibuted.
3. 16 U i~ a uni6o~m ~andom va~iabie on
(0,1), then the ~andom va~iable (-p ln(U))l/p
PROPOSITION
the inte~vai
o
ha~ the den~ity
Proof.
(9),
6un~tion
the distribution
f z tP- 1 exp(-tP/p)dt
(9).
Z with density function
The random variable
has for z ~ 0,
P (z )
given by 6o~mula
function
= l-exp(-zP/p).
o
Since for a random variable
the random variable P-1(1-U)
P, the proposition
U uniformly distributed on (0,1),
has the distribution function
is established.
THEOREM 2.16
Wl,WZ, ... ,Wn,Gl,GZ, ... ,Gn'U a~e independent ~andom va~iable~,Wl'WZ'
... 'Wn di~e~ete ~andom va~iable~ that may take only the value~ -1 and 1 eaeh with
p~obability liZ, G1,GZ' ... ,Gn ~andom va~iable~ gamma di~t~ibuted with ~hape pa~amete~ lip, U uni6o~mly di~t~ibuted on
(0,1), and
X.
1
(W.G.lip )/(Gl+GZ+
lIn
then the ~andom
t~ibuted
ve~to~
on the domain
.•.
.+G -In(U)) lip ,
1
:s:i~n,
(X1'XZ'X3'.·· ,Xn) i6 uni6o~mly
S(n,p).
di~-
19;::;
The proof of Theorem
position
Z results from Theorem
Z and 3.
1,
The Theorem Z leads to the UNIFS generating
of points P(x1 ,xZ,
main SCn,p).
Algorithm
UNIFS
•••
,xn) uniformly
distributed
(UNIFormly distribited
Sphere SCn,p) ).
Step O.
Read n,p.
Step 1.
Generate
U1,UZ,
bles uniformly
Step Z.
1 and Pro-
.•.
points inside the
,Un,U independent
distributed
algorithm
on the do-
random varia-
on (0,1).
Generate G1 ,GZ' .. ' ,Gn independent random variables
having a gamma distribution with shape parameter
lip.
Step 3.
S
Step 4.
If U.
+
(G1+GZ+"
1
i =
<
1/2
1 ,Z,3,4,
.+Gn-ln(U)) liP.
then W ......
-1;
1
...
else W ...- 1
1
(for
,n).
Step 5.
x . ..... w.G~/P/S;
Step 6.
Write the point P(x1,xZ,x3, ... ,xn). STOP.
1 ~ i ~n ,
111
REMARK 4. The UNIFS algorithm is very fast. Comparing
the results obtained by Deak [3] and Stefanescu [lZJ,
the
UNIFS algorithm (the case p = Z) is proved to be the fastest
algorithm
for generating
uniformly
distributed
points inside
the sphere of Euclidean norm.
For computer generating gamma and uniformly
distribut-
ted random variables, a subroutine library is used, the RAVAGE
(Vaduva [16J). It may be consulted the references [7J, [9J,
[10], [11] or more precisely
§4.
Other
uniformly
194
domains.
[1], [Z], [5], [6J, [14].
Further we shall generate
distributed
sequences
of
points on other bounded domains D,
D
n".
c
C
where
bi
4.1.
of
R,
e:
Let:
=
1 ~ i ~ n,
Uniformly
the
b
(c1,cZ""'cn),
h > 0,
and
distributed
following
(b"bZ,
=
for
(y 1 ' Y Z'
points
random
theorem
is
,b ) with c > 0,
n
i
, y n) e: Rn we have
similar
to
on S+(n,p).
that
of
The proof
Theorem
1.
+,
dam
ha~
THEOREM 3.16
Y1'YZ, ...,Yn,Yn
atte. inde.pe.nde.n-t ttanvattiable.~, Y"YZ'"
"Yn have EXPN(p) di~-tttibu-tian, Yn+1
-the de.n~i-ty 6unQ-tion
(9),
and
x
.i
=
Y.
1
I (yP
+ yP +
z·
-1
. . + ypn + yPn +' ) lip
-then -the. ttandom ve.Q-tott (X, ,XZ""
bu-te.d on -the. domain
5+(n,p).
From Theorem
3, for
2.
(Feller
COROLLARY
atte inde.pe.nde.n-t e.xponen-tial
p
=
[4J,
,
1 ~
i ~ n,
,Xn) i4 uni6attmly
di~-ttti-
1, we obtain
p.76).
ttandom
16 Ei,.'
vattiable.~
~i~n+l,
and
~ i ~ n,
-the.n -the. ttandom ve.Q-tOtL (X"XZ'·"
,Xn) i~ uni60ttmly
bu-te.d in -the. "unity"
n-6imple.x
5+(n,1).
di~-ttti-
]95
4.2. Uniformly distributed random points on S (n,p,h,c,b)
o
and S o +(n,p,h,c,b).
Starting from the points P(xl,x7, _ ... ,x),n
uniformly
distributed
on the domain
S(n,p),
the following
theorem enables the generation of points Q(Yl'Y2""
'Yn)
uniformly distributed inside the sphere S (n;p,h,~,6).
o
THEOREM 4. 76 ~he nandom veeton (Xl ,X2,·· .,Xn) ~~ un~6o~mly di~t~ibuted on the domain S(n,p) and
1 ~
then ~he ~andom
buted
vee~o~
(Yl ,YZ""
i ~ n,
,Yn) i~ uni6o~mly
d~~t~i-
on the domain So(n,p,h,c,b).
The proof follows
from Definition
1
and using
the
transformation
(25)
1 ~ i ~ n,
that is one to one between
whose Jacobian
REMARK
S(n,p)
and So(n,p,h,~,6)
and
is constant:
5. One
'mains
S 0+ (n,p,h,c,h)
with
(xl,x2, ... ,xn)
can obtain
a similar
considering
e:
for do-
result
the transformation
(25)
S+(n,p).
4.3. Uniformly distributed
random points on a bounded domain. For generating uniformly distributed random points on
a bounded domain D, D eRn, vol(D) f 0, we can use a compo-
sition-rejection
procedure.
We consider a partition
D.
1
n D. = 0,
J
lh this case the generation
196
{D'}l'"
J "J"m
of the domain
vol(D.) f 0,
J
of a uniformly
1~ i
random
<
D:
j ~m.
point
P(x"x7, _ ... ,xn ) in the domain D can be made by a random
choice of a domain Dj, 1 {. j ~ m (depending on vol(Dj)),
and then generating the uniformly distributed point on D ..
J
We can obtain uniformly
main
D.
J
by a rejection
distributed
points on the do-
procedure:
find a domain So(n,p,h,~,6)
includes the domain D.;
(or So+(n,p,h,~,6))
that
points P{x , ,xz'
,x )
J
- generate
uniformly
distributed
the domain So(n,p,h,c,b)
reject these points P(x,
The accepting
...
on
n
UNIFS);
(Theorem 4 and Algorithm
,xZ, ...
,xn)such that P ¢ OJ'
probability Pac of points into the do-
main D. is equal to
J
P
vol(D.)/vol(S
]
ac
0
(n,p,h,c,b))
~ ,.
We can increase the accepting probability value P
(accelac
erating the speed of rejection procedure) by finding
the
values p ,h ,c ,b of the parameters p,h,c,b so that
o
0
0
0
So(n,po,ho'co'So)'
with So(n,po,ho,co,bo)
the minimum volume.
4.4.
Uniformly
distributed
points
~
OJ' will have
on SS(n).
The following
result is well known
PROPOSITION
vecto/t
(X"XZ'"
main
S(n,2)-{O},
theY!
the
t/tibuted
4.
.,Xn)
(De
ak
i6 uni60/tmly
Itandom v e ct o a (Y"YZ,
on the
domain
Knuth
[3],
SS(n).
...
[7]).16
di~t/tibuted
,Yn)
the
/tandom
on the
i..~ uni60ltmly
do-
dcs>
Using Proposition
ller's
COROLLARY 3.
and
1, one obtains
(Muller
16
[8]).
Zl'Z2'Z3~'"
Jt:.andom vaJt:.iable~, noJt:.mally di~tJt:.ibu~ed
,Zn
wi~h
aJt:.e in-.
mean
vaJt:.ianQe 1, and
y.
~ i ~n ,
~
then the Jt:.andom vee~oJt:. (Y1'Y2'
buted on the domain
SS(n).
REMARK
points
used
Mu-
result.
dependen~
o
4 and Corollary
ia uni60Jt:.mly di~~Jt:.i-
""Yn)
6. In the case of uniformly
Q(Y1 'Y2'~"
'Yn) on SS(n),
=
(since vol(SS(n))
distributed
the Definition
random
1 is not
0).
REFERENCES
[1]
Ahrens,
J.H.,
a modi6ied
[2J
Ahrens,
(1982),
J.H.,
aampling
U., GeneJt:.ating gamma
vaJt:.ia~e~
by
Jt:.ejeQtion teQhnique.
Comm. ACM, 25,
1
Dieter"
47-54.
Kohrt,
K.D., Dieter,
6Jt:.omgamma
and
U.,
Poia~on
ACM Transactions
on Mathematical
(j un e 1 9 8 3),
255- 2 5 7 .
[3) Deak,
[4]
[5]
I., CompaJt:.iaon 06 me~hod~
dia~Jt:.ibu~ed Jt:.andom pointa
AIgoJt:.i~hm 599,
di~tJt:.ibution~.
Software,
9, 2
60Jt:.geneJt:.ating uni60Jt:.mly
in and on a hypeJt:.~phelt:.e.
Problems of Control and Information Theory, 8, 2
(1979),
105-113.
Feller, William., An in~Jt:.oduQ~ion to plt:.obability theolt:.tj
and i~a appliQation~.
John Wiley and Sons, New
Yo r k , 1 971 (vo 1. 2) .
Kinderman, A.J., Monahan, J.F., ComputeJt:. geneJt:.ation 06
Jt:.andom vaJt:.iable~ uaing the Jt:.a~io 06 uni60lt:.m devi~e~.
ACM Transactions of Mathematical
Software,
3,
3 (sept. 1977)
, 257-260.
[6] Kinderman, A.J., Monahan, J.F., New method~
60Jt:.geneJt:.ating Student'~t
and gamma valt:.iable~. Computing
25
(1980),369-377.
[7J Knuth, Donald E., The aJt:.t06 Qomputelt:. pJt:.oglt:.amming,SeminumeJt:.iQal algolt:.ithm~. Addison-Wesley,
London, 1981
(vol.2).
798
[8] Muller, M.E., A note 06 method 60~ gene~at~ng po~nt~
un~60~mty on n-d~men~nat~phe~e~.
Comm. ACM., 2
(april 1959),19-20.
on
[9] Nance, R.E., Overstreet Jr., C.L., A b~bl~og~aphy
~andom numbe~ gene~at~on. Computing Reviews, 13
(1972), 495-508.
[10] Sahai, Hardeo., A ~upplement to Sowey'~ b~bl~og~aphy
on ~andom numbe~ gene~at~on and ~elated tOP~Q¢·
J. Statist. Comput. Simul. 10 (1979), 31-52.
[11 ] Sowey, E.R., A Q~onolog~Qal and Qla~~~6~ed b~bl~og~aphy on ~andom numbe~ gene~at~on and te~t~ng. Int.
Statist. Rev., 40 (1972),355-371.
[ 1 21 Stef~nescu, Stefan Corneliu., A new method 60~ gene~at~ng un~60~ly
d~~t~~buted ~andom po~nt~ ~n a
hype~~phe~e. (in Romanian) Studii s i Ce rce t ar i
Ma t.emat i ce , 39,1 (1987), 71-78.
[ 1 31 Stef5nescu, Stefan Corneliu., Vaduva, Ion., On Compute~ gene~at~on 06 ~andom veQto~~ by t~an~60~mat~on~
06 un~60~mly d~~t~~buted veQto~~. (to appear in
Computing).
06 gamma
[ 1 4 J Tadikamalla, Pandu R., Compute~ gene~at~on
~andom va~~able~, I, II. Comm. ACM, 21, S (may.
1978), 419-422; (november 1978), 925-928.
06 gamma ~andom
[ 1 S] V~duva, Ion., On Qompute~ gene~ation
va~iable~ by ~ejeQt~on and Qompo~~t~on p~oQedu~e~.
Oper. forschung und Stat., Ser. Stat., 4 (1977),
545-576.
lib~a~y 60~ Qompu[ 1 6 J Vaduva, Ion., RAVAGE, a 6ub~outine
te~ gene~at~on 06 ~andom numbe~¢, ~andom va~~able~ and ~tOQha~tiQ p~OQe~~e~. GMD-Mitteilungen,
N~ 39, Gesellschaft fur mathematik und datenverarbeitung, MBH Bonn, 1977.
Unive~¢ity 06 BUQha~e~t
Comput~ng Cente~
'-'n~ve~~~ty 06 Buc-ha~e-6t
FaQulty 06 MathematlQ-6
BUQha~e~t,
Buc-ha~e~t,
Rumania
(Recibido en octubre de 1986).
Ruman~a
© Copyright 2025 Paperzz