Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I compute normally distributed 3D rotation matrices with Mathematica?

For 2D matrices I would sample a normal distributed angle and directly create a rotation matrix with:

normalRotation2[s_] := RotationMatrix[RandomVariate[NormalDistribution[0, s]]]

This has some kind of problems because the two tails of the distribution overlap at the far end due to the finite "size" of SO(2). I am not quite sure what the correct definition of normal distribution would be here... If there isn't any, let's use some next best concept like in normalRot2.

Now the question is how to do this in 3D?

Edit: For my purposes it would be enough to have an isotropic normal distribution.

share|cite|improve this question

migrated from Aug 12 '13 at 7:55

This question came from our site for users of Mathematica.

are you facing trouble with finding a NormalDistribution that generates 3D data ? – Rorschach Aug 11 '13 at 15:50
Is the primary question about mathematics, and secondarily about how to implement it in Mathematica? Does isotropic mean the axis is equally likely to point in any direction? If so, then this might help picking an axis. If you want uniform random rotations, then see this or this. By "normal" do you mean that the angle of rotation is normally distributed (mean = 0, s.d. = s)? – Michael E2 Aug 11 '13 at 19:03
What do you want to use this for? Because there are definitely cases when the wrap-around effect of the tails of the normal distribution for the periodic angle domain is a desired and needed effect. The fact that you write 'this has some problems' sounds like you actually want to do something else. You could e.g. use another distribution that decays to zero at the far end ($\theta=\pm\pi$). – Thies Heidecke Aug 11 '13 at 20:59
@Thies: I am using small standard deviations, so I do not care about the wrap-around. But thank you for the link, that was interesting. – Danvil Aug 14 '13 at 12:40
@E2: Both as I am usually prototyping with Mathematica before going to C++. With isotropic I wanted to say, that the normal distribution should treat all rotation directions equally. By "normal" I mean normally distributed -- so not uniform distributed or a purely random rotation. – Danvil Aug 14 '13 at 12:41
up vote 0 down vote accepted

After some digging into this problem I came to this solution: A quaternion

q = normalize(1, N(0,s), N(0,s), N(0,s))

with N(0,s) the Gaussian normal distribution with zero mean and standard deviation s generates an approximativly normally distributed rotation for small s.

share|cite|improve this answer
Sounds like a good idea. You'll want to normalize $q$ to a unit quaternion so that it represents a rotation. – Rahul Aug 16 '13 at 19:45
Totally forgot to write that down! – Danvil Aug 18 '13 at 16:13
The OP gave the following improved solution offline: "So after some thinking and experiments, actually I think the problem of random rotation diffusion is quite easy. You select a uniformly distributed rotation axis u (i.e. a uniformly distributed point on a 2-sphere) and a normally distributed rotation angle a. Then (cos(a/2), sin(a/2) u_x, sin(a/2) u_y, sin(a/2) u_z) gives a normally distributed rotation represented by a quaternion. This can be transformed to a rotation matrix if necessary." – Ray Koopman Oct 25 '13 at 2:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.