Random points on the unit n-sphere can be generated without the need for sqrt and trig. Generate n+1 independent Gaussian random numbers, and normalize the vector to unit length. -- Gene
________________________________ From: Cris Moore <moore@santafe.edu> To: math-fun <math-fun@mailman.xmission.com> Sent: Saturday, July 5, 2014 8:38 AM Subject: Re: [math-fun] Gary Antonick is edging away from the following bonus puzzle
Consider also the following lovely fact: choose a point on the unit sphere uniformly at random. It's z-coordinate is uniformly distributed in the interval [-1,+1]!
To put it differently, you can generate a random point (x,y,z) like this:
choose z uniformly in [-1,+1] choose theta uniformly in [0,2pi] set x = sqrt(1-z^2) cos theta, y = sqrt(1-z^2) sin theta
This is only true for the 3-dimensional sphere, of course!
- Cris