Hello everyone,(adsbygoogle = window.adsbygoogle || []).push({});

I copy-paste here a little bit of code:

The quantities x and y are calculated elsewhere.Code (Text):In[4417]:= x = (1.5` + 0.` I);

y = (0.` + 0.` I);

(* 1 *) ArcTan[x, y]

(* 2 *) ArcTan[x // Chop, y // Chop]

(* 3 *) -I Log[(x + I y)/Sqrt[x^2 + y^2]]

{y == 0, Re[y] == 0, Im[y] == 0, Im[x] == 0}

Out[4419]= -1.5708 + 0. I

Out[4420]= 0

Out[4421]= 0. + 0. I

Out[4422]= {True, True, True, True}

The expression 1 for the arctangent is wrong since it gives me -pi/2

In expression 2, I chop the arguments and the result is right.

Expression 3 is used when x or y is complex and gives the right answer as well.

Finally, some tests…

Any thoughts ?

TIA

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [Mathematica] ArcTan[] bug ?

**Physics Forums | Science Articles, Homework Help, Discussion**