Sunday, November 13, 2011

pick a random point on the surface of a unit sphere;mathematica

DOWNLOAD Mathematica Notebook
To pick a random point on the surface of a unit sphere, it is incorrect to select spherical coordinates theta and phi from uniform distributions theta in [0,2pi) and phi in [0,pi], since the area element dOmega=sinphidthetadphi is a function of phi, and hence points picked in this way will be "bunched" near the poles (left figure above).
To obtain points such that any small area on the sphere is expected to contain the same number of points (right figure above), choose U and V to be random variates on (0,1). Then
gives the spherical coordinates for a set of points which are uniformly distributed over S^2. This works since the differential element of solid angle is given by
Weisstein, Eric W. "Sphere Point Picking." From MathWorld--A Wolfram Web Resource.

No comments:

Post a Comment