Yes, of course... but the fact that z is uniform in [-1,+1] is quite surprising when you first see it.\ Cris On Jul 5, 2014, at 9:55 AM, Eugene Salamin via math-fun <math-fun@mailman.xmission.com> wrote:
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
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun