Re: equations

• To: mathgroup at smc.vnet.net
• Subject: [mg3801] Re: equations
• From: Jerry Bukley <jwbukley at tasc.com>
• Date: Sat, 27 Apr 1996 00:54:26 -0400
• Organization: TASC
• Sender: owner-wri-mathgroup at wolfram.com

```Michael Probst wrote:
>
> I have a mma - question concerning equation solving.
> I understand how to use Solve and Eleminate for basic
> problems but still my problem escapes me.
> It's rather simple.
> I have a rotation matrix rm:
> MatrixForm[rm]
> -0.772889    -0.568925    -0.28101
>  0.633718    -0.71461     -0.296198
> -0.0322979   -0.407009     0.912853
>
> which I know must be equal to the rotation matrix qrm:
>
> MatrixForm[qrm]
>   2     2     2     2
> q0  + q1  - q2  - q3     2 (q1 q2 - q0 q3)         2 (q0 q2 + q1 q3)
>
>                            2     2     2     2
> (q1 q2 + q0 q3)          q0  - q1  + q2  - q3      2 (-(q0 q1) + q2 q3)
>
>                                                      2     2     2     2
> 2 (-(q0 q2) + q1 q3)     2 (q0 q1 + q2 q3)         q0  - q1  - q2  + q3
>
> in the variables q0,q1,q2,q3
> I hope it's readable. As you might know, it's the rotation
> expressed in quaternions.
>
> If I have this, how do I get the values for q0,q1,q2,q3 ?
> ...I won't give you the Mathematica solution but I will give you the
quaternion
solution.  First, try to get a copy of "The Journal of the Astronautical
Sciences", Volume 41, No.4.  This entire volume is on attitude
representation
and discusses euler angles and quaternions.

Mathematica may have a problem solving this equation.  I have worked on
it
manually (pre-Mathematica) and always used multiple approaches depending
on
the values.  The answer is NOT a least square fit because some of the
solutions
will have singularities.  Let me correct qrm(2,1), I believe that is
2(q1 q2 + q0 q3).  Also, all my references have the following:

q0  + q1  - q2  - q3     2 (q1 q2 + q0 q3)         2 (-(q0 q2) + q1 q3)

2     2     2     2
2 (q1 q2 - q0 q3)        q0  - q1  + q2  - q3      2 (q0 q1 + q2 q3)

2     2     2
2
2 (q0 q2 + q1 q3)        2 (-(q0 q1) + q2 q3)      q0  - q1  - q2  + q3

so check your calculations (and my typing).

One cookbook solution is:

Define a working quaternion
p = 2 (q0 + q1 + q2 + q3)  {= [p1, p2, p3, p4] sorry, I use 1-4 instead
of 0-3}

Define the trace of the rotation matrix (and as a nemonic define M00 =
T)
M00 = T = M11 + M22 + M33

These equations can be combined to yield:
p1^2 = 1 + M00 - T
p2^2 = 1 + M11 - T
p3^2 = 1 + M22 - T
p4^2 = 1 + M33 - T

The off-diagonal terms yield:
p1 p2 = M32 - M23
p1 p3 = M13 - M31
p1 p4 = M21 - M12
p3 p4 = M32 - M23
p4 p2 = M13 - M31
p2 p3 = M21 - M12

There are now ten equaitons with four unknowns.  Numerical problems are
minimized by
choosing the largest pi from the first set of four equations.  Complete
the
quaternion by solving the appropriate three equations from the second
set of six.

Good luck,
Jerry

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: MOVIES
• Next by Date: Re: equations
• Previous by thread: Re: equations
• Next by thread: Re: equations