comp.lang.ada
 help / color / mirror / Atom feed
* Arctan: to use with single or with double arguments?
@ 2010-09-24 21:32 Ada novice
  2010-09-24 21:55 ` Jeffrey Carter
  0 siblings, 1 reply; 16+ messages in thread
From: Ada novice @ 2010-09-24 21:32 UTC (permalink / raw)


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







^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-02-11 16:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-24 21:32 Arctan: to use with single or with double arguments? Ada novice
2010-09-24 21:55 ` Jeffrey Carter
2010-09-25  8:44   ` Ada novice
2010-09-25 17:31     ` Jeffrey Carter
2010-09-25 21:34       ` Ada novice
2010-09-26  4:02         ` jpwoodruff
2010-09-26  8:21           ` Ada novice
2010-09-26  7:31         ` Jeffrey Carter
2010-09-26  8:24           ` Ada novice
2012-02-11  0:26             ` Jack Mitchell
2012-02-11  1:11               ` Adam Beneschan
2012-02-11  8:53                 ` Simon Wright
2012-02-11 10:46                   ` AdaMagica
2012-02-11 15:29                     ` Simon Wright
2012-02-11 16:21                       ` Georg Bauhaus
2012-02-11 16:47                         ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox