From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fe315ab08ea9576,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!s19g2000vbr.googlegroups.com!not-for-mail From: Ada novice Newsgroups: comp.lang.ada Subject: Arctan: to use with single or with double arguments? Date: Fri, 24 Sep 2010 14:32:40 -0700 (PDT) Organization: http://groups.google.com Message-ID: <908e7aea-ed77-4dce-9f5d-e6341abc1303@s19g2000vbr.googlegroups.com> NNTP-Posting-Host: 193.11.22.91 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1285363960 799 127.0.0.1 (24 Sep 2010 21:32:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 24 Sep 2010 21:32:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s19g2000vbr.googlegroups.com; posting-host=193.11.22.91; posting-account=Rr9I-QoAAACS-nOzpA-mGxtAlZ46Nb6I User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 (.NET CLR 3.5.30729),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14244 Date: 2010-09-24T14:32:40-07:00 List-Id: Hi, I'm computing a Jacobian matrix (having elements as partial derivatives) and some matrix elements have expressions like Z = Force * Sin (A) where A is the inverse tangent of some function, and this function has a numerator Y and a denominator X. So I have Z_Method1 := Force * Sin(Arctan(Y, X)) using Arctan with double arguments or we get Z_Method2 := Force * Sin(Arctan(Y / X)) using Arctan with single a argument. Now I know that Arctan(Y, X) gives the result between -pi to pi while Arctan(Y / X) gives the result between -pi/2 to pi/2. For some cases of X and Y, I could see that Z_Method1 won't be equal to Z_Method2. In fact, Z_Method1 differs from Z_Method2 in the sign in the following 2 cases: --------------------------------------------------------------- CASE 1: BOTH X AND Y -VE: ANSWER IS BETWEEN -PI AND -PI/2 y is numerator and x is denominator --------------------------------------------------------------- y = -3.000 x = -1.000 Two arguments Arctan(y,x)---Answer is between -pi to pi Angle in rad is -1.893 and Angle in degrees is -108.435 Sine is -0.949 --------------------------------------------------------------- One argument Arctan(y/x)---Answer is between -pi/2 to pi/2 Angle in rad is 1.249 and Angle in degrees is 71.565 Sine is 0.949 and in the 2nd case: --------------------------------------------------------------- CASE 2: X = -VE AND Y +VE: ANSWER IS BETWEEN PI/2 AND PI y is numerator and x is denominator --------------------------------------------------------------- y = 3.000 x = -1.000 Two arguments Arctan(y,x)---Answer is between -pi to pi Angle in rad is 1.893 and Angle in degrees is 108.435 Sine is 0.949 --------------------------------------------------------------- One argument Arctan(y/x)---Answer is between -pi/2 to pi/2 Angle in rad is -1.249 and Angle in degrees is -71.565 Sine is -0.949 Both Z_Method1 and Z_Method2 are computing Z = Force * Sin (A) as mentioned above. Now, a Jacobian matrix is normally used in a linearization procedure when trying to "simplify" a nonlinear system. This Jacobian matrix can be consequently be solved for its eigenvalues to determine the stability of the system. In the 2 cases above I get Z = Force * Sin (A) with different signs. Which of Z_Method1 and Z_Method2 to choose? Z_Method1 with the double arguments in the Arctan function or Z_Method2 with the single argument in the Arctan function? Thanks a lot...