Re: solving for 2 angles
- To: mathgroup at smc.vnet.net
 - Subject: [mg89821] Re: solving for 2 angles
 - From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
 - Date: Sat, 21 Jun 2008 05:32:25 -0400 (EDT)
 - Organization: The Open University, Milton Keynes, UK
 - References: <g3g00h$kvd$1@smc.vnet.net>
 
Steve wrote:
> I have two equations with unknown angles az and el:
> 
> J*cos(az)*sin(el)+K*sin(az)*sin(el)+L*cos(el)=0;
> M*cos(az)*sin(el)+N*sin(az)*sin(el)+P*cos(el)=0;
> 
> Is it a simple matter to solve for the angles?
> 
> I tried taking the first equation, and re-writing as:
> 
> sin(el)*[J*cos(az)+K*sin(az) ] = -L*cos(el)
> 
> which leads to
> 
> el= atan(-L / [J*cos(az)+K*sin(az)])
> 
> I then subsituted this into the second equation, but was not able to
> isolate the az variable.
Steve,
This newsgroup is dedicated to Mathematica, software made and published 
  by Wolfram Research, Inc. Thus, I assume that you are using it and I 
shall show you the syntax and command to use to get the complete set of 
solutions.
eqns =
    {J*Cos[az]*Sin[el] + K*Sin[az]*Sin[el] + L*Cos[el] == 0,
        M*Cos[az]*Sin[el] + N*Sin[az]*Sin[el] + P*Cos[el] == 0};
Reduce[eqns, {az, el}]
((C[1] | C[2]) \[Element] Integers && ((L == 0 && P == 0 &&
         az == Pi + 2 Pi C[1] && el == Pi + 2 Pi C[2]) ||
                        2    2           2    2                L M
       (J != 0 && ((L (J  + L  - J Sqrt[J  + L ]) != 0 && P == --- &&
                                                                J
             az == Pi + 2 Pi C[1] &&
                                        2    2
                             -J + Sqrt[J  + L ]
             el == 2 (ArcTan[------------------] + Pi C[2])) ||
                                     L
                2    2           2    2                L M
           (L (J  + L  + J Sqrt[J  + L ]) != 0 && P == --- &&
                                                        J
  <...>
(* the rest of this *very* long output has been deleted for the reader's 
sake. Just evaluate the original expressions within Mathematica on your 
system to get it again. *)
Regards,
-- Jean-Marc