MathGroup Archive 1993

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

Search the Archive

trig functions

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: trig functions
  • From: bappadit at ecn.purdue.edu (Banerjee Bappaditya)
  • Date: Mon, 7 Jun 93 21:30:10 -0500

Hi!
I am trying to find the appropriate quadrant (from -Pi to Pi) 
to which the inverses of trignometric functions evaluate.  I have figured out the following rules...

if Sin[theta]>=0 && Cos[theta]>=0, angle = theta
if Sin[theta]>=0 && Cos[theta]<=0, angle = ArcCos[Cos[theta]]

if Sin[theta]<0 && Cos[theta]<0, angle = ArcSin[Sin[theta]] + Pi/2
if Sin[theta]=0 && Cos[theta]=-1, angle = -Pi  
if Sin[theta]=-1 && Cos[theta]=0,angle = -Pi/2

if Sin[theta]<=0 && Cos[theta]>=0, angle = ArcSin[Sin[theta]]

How can I do this in Mma 1.2  so that a function 

Angle[expression evaluating to a number] gives the correct theta ? 

Or in other words, reduces the "expression " to modulo Pi.

I have (unsuccessfully!!!) tried


Angle[theta_] := If[Sin[theta]>=0 && Cos[theta]>=0,theta,
                 If[Sin[theta]>=0 && Cos[theta]<=0,ArcCos[Cos[theta]] ,
                 If[Sin[theta]=-1 && Cos[theta]=0,-Pi/2 ,
                 If[Sin[theta]<0  && Cos[theta]<0,ArcSin[Sin[theta]] + Pi/2 ,
                 If[Sin[theta]=0  && Cos[theta]=-1,-Pi ,
                 If[Sin[theta]<=0 && Cos[theta]>=0,ArcSin[Sin[theta]] 
                  ]]]]]] 


Angle[theta_] := If[Sin[theta]>=0 && Cos[theta]>=0,theta,
                 If[Sin[theta]>=0 && Cos[theta]<=0,ArcCos[Cos[theta]] ,
                 If[Sin[theta]<0 && Cos[theta]<0,ArcSin[Sin[theta]] + Pi/2 ,
                 If[Sin[theta]<=0 && Cos[theta]>=0,ArcSin[Sin[theta]] 
                  ]]]]


It does not work in the 3rd Quadrant i.e. from -Pi/2 to -Pi.

I would appreciate any help.


thanks,

bappa.


Bappaditya Banerjee
bappadit at mn.ecn.purdue.edu
Ray W. Herrick Laboratories
Purdue University
West Lafayette, IN 47907
work : (317) 494 2132
       (317) 494 2147
fax  : (317) 494 0787
home : (317) 743 3982

 


  • Prev by Date: Re: 2D Integration
  • Next by Date: Problem with Times. Bug ????
  • Previous by thread: Computer Algebra Systems emphasizing Mathematica
  • Next by thread: Re: trig functions