MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Random spherical troubles

  • To: mathgroup at
  • Subject: [mg25254] Re: [mg25218] Re: [mg25170] Random spherical troubles
  • From: Tomas Garza <tgarza01 at>
  • Date: Sun, 17 Sep 2000 04:47:33 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Daniel Lichtblau has kindly pointed out that my remark concerning the 
need to discard points lying outside the unit sphere was wrong. It is 
indeed necessary. A uniform distribution of points inside the unit cube 
doesn't yield a uniform distribution of the points on the intersection 
of the sphere with the cube. Sorry about that (this happens when one 
talks before thinking) :-(. For example, in two dimensions, the 
contribution from the points lying outside the unit circle in the first 
quadrant results in a probability density function of points on the unit 
circle proportional to

fun[x_] := Tan[x]/2 /; 0 <= x < Pi/4;
fun[x_] := Tan[Pi/2 - x]/2 /; Pi/4 <= x <= Pi/2;

This density function looks awfully different from a uniform! Curiously 
enough, the graph of the corresponding distribution function (cumulative 
distribution function) is remarkably well-behaved and if one plots it 
together with a normal CDF with mean Pi/4 and standard deviation of 0.31 
(this value comes from trial and error experimentation) the agreement is 
surprisingly good.  

Tomas Garza
Mexico City

> Your question has certainly attracted quite a number of solutions. 
> I think Daniel Lichtblau (in his (i)) and Ranko Bojanic offer the more 

> straightforward. I assume that "randomly distributed over the whole
> solid angle" means that they obey a uniform distribution in three
> dimensions. It is clear that the line going from the origin to the 
> in three dimensions generated by {Random[], Random[], Random[]} is 
> (pseudo) randomly distributed inside the first octant. The following
> code will generate 100 (pseudo) randomly directed lines from the 
> It will show a scatter plot of such lines in 3D, where the points in 
> lie on the unit sphere and have the same direction as the 
> points in blue directly generated by three randomly chosen coordinates 

> (you needn't discard those points originally lying outside the unit
> sphere, as Daniel suggests).

  • Prev by Date: Re: How to display the desired numerical precision?
  • Next by Date: Re: Testing the Head of List Elements
  • Previous by thread: Re: Random spherical troubles
  • Next by thread: Re: Random spherical troubles