Behavior of ArcTan when two zeros are given as arguments

When you write ArcTan[0,0], you tell Mathematica that the parameters x and y in ArcTan[x,y] are the exact integer 0. As we know, 0/0 cannot be unambiguously defined, and Indeterminate is returned. So ArcTan[0,0] returns the result of Interval[{-Pi,Pi}], for the codomain of ArcTan[0,0] is just between -Pi and Pi.

On the other hand, if you write ArcTan[0.0,0], y is the exact integer 0, but x is approximate real numbers which approaches 0 but not the exact interger 0. Therefore, (exact 0)/(approximate 0) = exact 0, resulting in ArctTan[0.,0] == 0.( Similar for ArcTan[0,0.] == Pi/2)

Now, consider why ArcTan[0.,0.] returns Interval[{-Pi,Pi}], similar to ArcTan[0,0]. For this question, we must first keep it in mind that every approximate real numbers in Mathematica has its finite precision and accuracy. The default precision in Mathematica can be obtained by $MachinePrecision, which is 15.9546.

So, in the default setting, the paremeters x and y in ArcTan[0.,0.] have the same precision. Let me draw an analogy: when x and y have the the same precision 10,they can see each other the same effective number of digits, that is, the first 10 numbers of x and y are all 0. As for the 11th number and those after that, Mathematica did not take them into account when calculating, since those numbers are out of the precision and ambiguous. As a result, ArcTan[0.,0.] involves the situation 0/0, returning Indeterminate.

Now, let us make a little change-just increase one of parameters (x or y) to the precision 16, such as ArcTan[N[0,16],0.], which returns Pi/2. This is because x=N[0,16] has greater precision than y=0. (which is just 15.9546). So, y with the precision of 15.9546 can only see x the first 15.9546 numbers and think x is 0, while x with precision 16 can see what the y's 16th number is and think y is not 0. Hence, (Not 0)/0 causes Infinity. (Similar to ArcTan[0.,N[0,16]] returning 0)

The above analogy may be inexact, but in short, the phenomenon in question is related to the precision of real numbers in Mathematica.

If you expect to obtain in the case of ArcTan[0.,0] an indeterminate result, you can use Chop function. ArcTan[Chop[0.],0] returns Indeterminate.

Hope this will help you.


I think you get this result because for Mathematica handles 0.0 here as a number which approaches 0.

Define e.g.

f[x_, y_] := ArcTan[y/x]

As for ArcTan[0,0] you get for f[0,0] a not meaningful result (lastly because a point at (0,0) can enclose with the abscissa all angles from [-π,π], therefore also the output Interval[{-π,π}]).

But if you use

 Limit[f[x, 0], x -> 0]

You get as for ArcTan[0.,0] as result 0. The same works if you use the limit for y:

ArcTan[0,0.] and Limit[Limit[f[x,y],x -> 0],y -> 0]give as result π/2.

So, by writing ArcTan[0,0.] you are telling Mathematica that you are approaching the (0,0) on the y-axis and this gives then the same result as e.g. ArcTan[0,10] (similar for ArcTan[0.,0]).

If you use ArcTan[0.,0.] you are approaching (0,0) on both axes to the same time. This is geometrically not possible (the point can only be on both axes to the same time in the origin of the coordinate system; thats why I used two limits above), therefore you get here again as result Interval[{-π,π}].


I used Arg[x + i y] to compute ArcTan[y/x], and it gives 0 for all the variations of x = 0 and y = 0 mentioned in the description.

Tags:

Trigonometry