A feature of quaternions that is even more remarkable has not so far been explicitly discussed at all: the fact that uniformly distributed unit quaternions (transitive in all 4 components) correspond to "random" 3-space rotations (scalar angle unrelated to 3 axis vector components)! This is reminiscent of the Stewart platform representation of 3-space isometries as a function of 6 transitive variables, contrasted with the familiar 3+3 dichotomy between rotation and translation. There is an admirably succinct discussion of this problem at http://math.stackexchange.com/questions/131336/uniform-random-quaternion-in-... which commences with a transitive generator for random quaternions involving sqrts, trig fns and 3 uniform variables (citation Ken Shoemake). Is there a rational generator, presumably using more uniform variables? If rejection is allowed, the simplest possibility is surely just to generate 4 uniform unit components, reject vectors with norm exceeding unity, otherwise scale up to unity; success rate is (pi^2/2)/2^4 ~ 30% . What about a transitive generator for 3-space isometries ... Fred Lunnon On 7/5/14, Eugene Salamin via math-fun <math-fun@mailman.xmission.com> wrote:
Yes, I slipped up; you do need sqrt to normalize the vector.
That z is uniform in [-1,+1] is a consequence of the solid geometry theorem that the area of a sphere between two parallel planes depends only on the separation between the planes, and is independent of what part of the sphere lies between the planes.
Also, in doing integrations over the sphere in spherical coordinates, the element of area sinθ dθ dφ under the change of coordinates μ = cosθ becomes dμ dφ.
-- Gene
________________________________ From: Cris Moore <moore@santafe.edu> To: Eugene Salamin <gene_salamin@yahoo.com>; math-fun <math-fun@mailman.xmission.com> Sent: Saturday, July 5, 2014 9:47 AM Subject: Re: [math-fun] Gary Antonick is edging away from the following bonus puzzle
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 followingbonuspuzzle
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