espressomd-users
[Top][All Lists]
Advanced

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

Re: [ESPResSo] bug in random.tcl in mbtools


From: Markus Deserno
Subject: Re: [ESPResSo] bug in random.tcl in mbtools
Date: Thu, 19 Mar 2009 08:48:58 -0400 (EDT)
User-agent: SquirrelMail/1.5.1 [CVS]

Hi,

the discussion for how to draw numbers equidistributed
on the surface of the sphere has been recently discussed
on the Espresso list.  Torsten has corrected a previously
biased version somewhere else in the code.  Let me remind
you how it's done:

1. Draw a random number z equidistributed between -1 and 1.
2. Draw a random number f equidistributed between 0 and 2 pi.
3. Calculate r := sqrt(1-z^2)
4. Then the following triplet (x,y,z) is a point on the unit
   sphere picked from a uniform distribution on that sphere:
   x = r cos(f)
   y = r sin(f)
   z

Best,

Markus

-- 
Dr. Markus Deserno
Associate Professor of Physics    ++1-412-268-4401 (office)
Carnegie Mellon University        ++1-412-681-0648 (fax)
5000 Forbes Avenue                ++1-412-268-8367 (Donna Thomas)
Pittsburgh, PA 15213              address@hidden





reply via email to

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