swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

random vector generation


From: Chris Landauer
Subject: random vector generation
Date: Fri, 8 Oct 1999 13:57:35 -0700

hihi, all -

the original question was to get a random vector with each coordinate
non-negative and sum equal to 1

the obvious (and incorrect) way to do it is to generate random values in
[0,1], and divide all the entries by the sum of them - it is true that the sum
of the resulting coordinates is 1, but the distribution is not uniform

        imagine the case n=2 -
        we generate a uniform random point in the unit square,
        and then project it perpendicularly onto the line from (1,0) to (0,1)
        (the reverse diagonal, upper left to lower right) -
        the relative probability of generating any point on the line
        is then the length of the line segment projected onto it

        a correct way (for n=2) would be to choose the first coordinate,
        and compute the second one from the constraint that the coordinates
        sum to 1

so i think that in general, the procedure of choosing one value and
subtracting it from the remaining sum will work (though i haven't worked out
an induction proof that i like yet)

all of this is predicated on the assumption that the resulting distribution is
intended to be uniform - if that is not needed, then of course, other
generation methods can be used

more later,
cal

Dr. Christopher Landauer
Aerospace Integration Science Center
The Aerospace Corporation, Mail Stop M6/214
P.O.Box 92957
Los Angeles, California 90009-2957, USA
e-mail: address@hidden
Phone: +1 (310) 336-1361


                  ==================================
   Swarm-Modelling is for discussion of Simulation and Modelling techniques
   esp. using Swarm.  For list administration needs (esp. [un]subscribing),
   please send a message to <address@hidden> with "help" in the
   body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]