This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: gsl_rand_dir_3d
- From: James Theiler <jt at lanl dot gov>
- To: Stuart O Anderson <soa at andrew dot cmu dot edu>
- Cc: <gsl-discuss at sources dot redhat dot com>
- Date: Mon, 4 Aug 2003 14:38:46 -0600 (MDT)
- Subject: Re: gsl_rand_dir_3d
On Mon, 4 Aug 2003, Stuart O Anderson wrote:
] After looking at the algorith a while longer I've begun to suspect it has
] a more serious flaw than the s==0 condition. If the Z component is
] uniformly distributed (since P(x*x+y*y < s | s<=1 ) = s) and the final
] vector's orientation in the X-Y plane is also uniform and independent of Z
] then the probability of selecting a final vector with -.5<Z<.5 is equal
] to the probability of selecting a final vector with -1<=Z<=-.5 or .5<=Z<=1.
] Since the surface area of these two sections is not equal but the
] probability of selecting a vector in each section is equal, the
] distribution cannot be uniform over the surface of the sphere, since the
] probability of selecting a vector in any two regions of equal surface
] area must be equal in a uniform distribution.
]
] Can someone confirm this?
]
] Stuart
]
Actually, I believe the surface areas of the two regions you describe
*are* equal. This is at first a little counter-intuitive, but you
should work it out. The region near the equator seems to have larger
area because it is farther from the axis, but the region around the
poles has an extra cosine effect which makes up for this. Hard to
describe without a picture, but if you try to work it out, I think
you'll see what I'm talking about.
jt
---------------------------------------------
James Theiler jt@lanl.gov
MS-B244, NIS-2, LANL tel: 505/665-5682
Los Alamos, NM 87545 fax: 505/665-4414
----- Space and Remote Sensing Sciences -----