MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3785] Re: equations
  • From: Paul Abbott <paul at earwax.pd.uwa.edu.au>
  • Date: Sun, 21 Apr 1996 23:24:19 -0400
  • Organization: University of Western Australia
  • Sender: owner-wri-mathgroup at wolfram.com

Michael Probst wrote:
 
> 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 think qrm should be (a 2 is missing in the {2,1} element):

   2     2     2     2
 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

> If I have this, how do I get the values for q0,q1,q2,q3 ?

One way is to use FindMinimum.  Computing the squared difference between 
qrm and rm and summing all terms:

	(Plus @@ Plus @@ ((qrm - rm)^2)) // Expand;

then

	FindMinimum[%, {q0,1.},{q1,0.},{q2,1.},{q3,1.}]

(with arbitrary starting values) yields {q0,q1,q2,q3}:

	          -13
	{3.7037 10   , {q0 -> 0.326096, q1 -> -0.0849531, q2 -> -0.190674, 
		q3 -> 0.922002}}

As a check, we substitute this answer back into the difference:

	qrm-rm /. Last[%]

	             -7            -8            -7
	{{-1.19421 10  , 4.37326 10  , 3.18153 10  }, 
 
	             -7             -8            -7
	  {3.01553 10  , -9.22842 10  , 1.46602 10  }, 
 
	              -7             -7             -7
	  {-1.09731 10  , -1.50041 10  , -3.12856 10  }}

Cheers,
	Paul 

_________________________________________________________________ 
Paul Abbott
Department of Physics                       Phone: +61-9-380-2734 
The University of Western Australia           Fax: +61-9-380-1014
Nedlands WA  6907                         paul at physics.uwa.edu.au 
AUSTRALIA                           http://www.pd.uwa.edu.au/Paul
_________________________________________________________________

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


  • Prev by Date: Help on Function
  • Next by Date: Using mathematica for vector math
  • Previous by thread: Re: Help on Function
  • Next by thread: Re: equations