News for hackers. Stuff that matters.
Re:Random Points on a Sphere by davmre on Monday April 27, 2015 @03:38AM (#9444832)
As others have pointed out, the distinction between randn() and rand() is crucial here - the former gives you points from a (spherically symmetric) normal distribution, the latter gives you uniform points from the unit cube.

One of the advantages of the normal-sampling route over @ginko's rejection-based method is that in high dimensions almost all of the volume of the unit cube is situated outside of the unit sphere (the volume of the unit cube is always 1, whereas the volume of the unit sphere decreases exponentially with dimension). So the rejection method becomes exponentially slow in high dimensions, while the Gaussian method still works just fine.

Re:Random Points on a Sphere by Retr0spectrum on Monday April 27, 2015 @05:44AM (#9445219)
Surely there would still be a bias towards the corners?
Re:Random Points on a Sphere by darkmighty on Monday April 27, 2015 @05:55AM (#9445248)
Interestingly, there isn't for Gaussians (see my comment below).

Other simple distributions tend to give biases towards the corners or axis. Perhaps the Gaussian is unique in this regard? I'm not sure.

Re:Random Points on a Sphere by madcaptenor on Monday April 27, 2015 @09:33AM (#9446126)
In three dimensions (to keep the notation reasonably simple) you need a distribution with density f such that f(x)f(y) f(z) is a function of x^2 + y^2 + z^2 (i. e. the distance from the origin). It looks like the Gaussian (up to scaling) is the only one.
Re:Random Points on a Sphere by OscarCunningham on Monday April 27, 2015 @10:43AM (#9446599)
Yes, the fact that i.i.d. Gaussians give a rotationally symmetric joint distribution is a defining property of the Gaussian.
Re:Random Points on a Sphere by darkmighty on Monday April 27, 2015 @11:30AM (#9446914)
Ah I suspected as much. Can you provide proof?

I think I found one, but I'm not sure:

Without loss of generality, take f(xi) = k1 * exp(-g(xi)) [1], for some g. Then we need the joint pdf to satisfy f(x1,...,xn) = k2 * exp(-h(R^2)), R=sum(xi^2)^1/2 (the R^2 and h(.) is w.l.g. too). So we get g(x1)+g(x2)=h(x1^2+x2^2). Then assuming the functions g and h analytic we end up needing g(x)= k * x^2, otherwise we get cross terms in the Taylor expansion that can't be cancelled out for all xi. Sounds good?

[1] The function f trivially needs to be symmetric, justifying no loss of generality.

Re:Random Points on a Sphere by madcaptenor on Wednesday April 29, 2015 @09:34AM (#9458123)
Perhaps coincidentally, someone just asked about this at math.stackexchange: http://math.stackexchange.com/questions/1255637/joint-pdf-of...
Re:Random Points on a Sphere by darkmighty on Wednesday April 29, 2015 @10:10AM (#9458319)
Yes, that was me :)

I wanted to make sure I got a proof, since I didn't really find this elsewhere.

Re:Random Points on a Sphere by asdkashdkjashd on Monday April 27, 2015 @01:05PM (#9447612)
You have to assume that the one-dimensional marginals are Gaussian for otherwise the statement is not correct.
Re:Random Points on a Sphere by darkmighty on Monday April 27, 2015 @06:55PM (#9449622)
Hmm I'm not sure I get your point. I'm trying to prove that the joint pdf of N iid RV's is isotropic if and only if the RV's are gaussian. If I assume the pdfs are gaussian in the first place the proof isn't valid?
Re:Random Points on a Sphere by asdkashdkjashd on Monday April 27, 2015 @07:48PM (#9449819)
Oh, I see. I thought you were trying to prove something different.