rotation angles from rotation matrix

• To: mathgroup at smc.vnet.net
• Subject: [mg80030] rotation angles from rotation matrix
• From: will <willpowers69 at hotmail.com>
• Date: Sat, 11 Aug 2007 02:03:23 -0400 (EDT)

```Dear Math forum,

I found some useful code for retrieving the Euler angles of a rotation from a rotation matrix; see

http://forums.wolfram.com/mathgroup/archive/2001/Aug/msg00286.html

which goes as follows:

In[1]:=
Needs["Geometry`Rotations`"]

In[2]:=
B=RotationMatrix3D[Pi/3,Pi/4,Pi/6];

In[3]:=
Solve[RotationMatrix3D[Ï?,Î¸,Ï?]\[Equal]B,{Ï?,Î¸,Ï?}]

From In[3]:=
Solve::ifun: Inverse functions are being used by Solve, so some
solutions may \
not be found.

Out[3]=
{{\[Psi] -> Pi/6, \[Theta] -> Pi/4, \[Phi] -> Pi/3}}

However, I noticed that if instead of exact rotations being entered, numerical approximations are entered:

In[4]:=
A=RotationMatrix3D[Pi/3.,Pi/4.,Pi/6.];

then solve no longer finds the solution...

In[5]:=
Solve[RotationMatrix3D[Ï?,Î¸,Ï?]\[Equal]A,{Ï?,Î¸,Ï?}]

Out[5]=
{}

my problem is that i have a rotation matrix

{{0.977431, 0.158491, 0.139673}, {-0.0822761,
0.894559, -0.439311}, {-0.194572, 0.417905, 0.88741}}

and i really want to find the rotations that are described by this matrix, either in Euler angles (for mathematica vs 5.2), or (preferably) in xyz (pitch-roll-yaw) convention (for mathematica vs 6). I am sorry if this is a very simple problem, but i don't know much about matrix maths...