Re: trig functions
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: trig functions
- From: roland at afthp001.tuwien.ac.at (Roland Bauer)
- Date: Thu, 17 Jun 93 12:30:44 +0200
Received: from reggae.concert.net by afthp001.tuwien.ac.at with SMTP (16.6/16.2) id AA08683; Wed, 9 Jun 93 17:02:04 +0200 Return-Path: <mathgroup-adm at yoda.physics.unc.edu> Received: from yoda.physics.unc.edu by reggae.concert.net (5.59/tas-reggae/8-15-92) id AA29347; Wed, 9 Jun 93 02:59:52 -0400 Received: by yoda.physics.unc.edu (4.1/TAS/11-16-88) id AA05299; Wed, 9 Jun 93 00:31:00 EDT Received: by yoda.physics.unc.edu (4.1/TAS/11-16-88) id AA05295; Wed, 9 Jun 93 00:30:59 EDT Message-Id: <9306090430.AA05295 at yoda.physics.unc.edu> Date: Mon, 7 Jun 93 21:30:10 -0500 From: bappadit at ecn.purdue.edu (Banerjee Bappaditya) To: mathgroup at yoda.physics.unc.edu Subject: trig functions 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 Hi Bappa, if you want to have a saw-tooth with the period a, You can define the following function: y[x_,a_]:=a(Mod[(x/a)+0.5,1]-0.5) Then plot it with e.g. Plot[y[x,360],{x,-500,+500}] The function y transforms every angle into the range from -(a/2) to +(a/2). Maybe this was Your Problem? Bye, Roland. -- --------------------------------------------------------------------------- | Roland BAUER tel: +43 (222) 58-801 / 4861 | | Abt. Foerdertechnik fax: +43 (222) 586-58-47 | | email: bauer at afthp001.tuwien.ac.at | | Getreidemarkt 9 | | A - 1060 VIENNA / AUSTRIA / EUROPE | --------------------------------------------------------------------------- | Technische Universitaet Wien | | Institut fuer Allgemeine Maschinenlehre und Foerdertechnik | | Abteilung Foerdertechnik (321/2) | ---------------------------------------------------------------------------