# User defined ArcTan function

I am trying to integrate an equation that requires an angle term calculated using ArcTan[x,y]. A number of issues have been mentioned about ArcTan in some of the older questions (Link here) and I wanted the ArcTan function to give out 0 as an output when I give ArcTan[0,0] as an input.

I have defined my ArcTan function as:

myArcTan[x_,y_] := Which[x > 0 || y > 0 || x < 0 || y < 0 , ArcTan[x, y],
x == 0 && y == 0, 0];


Question1: Is myArcTan correctly defined for what I am trying to do?.

When I use myArcTan as one of the terms in the indefinite integral given below, I get a different answer than when using ArcTan. Definite integral, however, gives the same result for both the cases:

Integral1 = Integrate[myArcTan[x, y], y, x]
Integral1 /. {x -> 1, y -> 0}
Out= 1/4

Integral2 = Integrate[ArcTan[x, y], y, x]
Integral2 /. {x -> 1, y -> 0}
Out= 0

Integrate[myArcTan[x, y], {y, -1, 1}, {x, -1, 1}]
Out= 0

Integrate[ArcTan[x, y], {y, -1, 1}, {x, -1, 1}]
Out= 0


Question 2: One of the answers given in the older question (Link here) uses Arg[x + i y] but an indefinite integral using Arg does not evaluate. Only a numerical approximation using NIntegrate works on it. Why is this so?, can one do an indefinite integral using Arg?.

• An indefinite integral is not a function. It’s an equivalence class of functions up to constant difference (the $+C$ from calculus). Mathematica gives one representative of that equivalence class. Perhaps that’s what you’re seeing. From the Help in Mathematica 11: “Different forms of the same integrand can give integrals that differ by constants of integration.” – Steve Kass Apr 11 '18 at 17:55
• Right, I totally forgot about it. But, I'm still not sure about the problem of ArcTan[0,0] being undefined and my implementation of it (myArcTan). – dykes Apr 11 '18 at 18:40
• Have you tried out some of the alternate expressions listed in Wikipedia? – J. M.'s technical difficulties Apr 11 '18 at 21:07
• @J.M. As per Wikipedia myArcTan looks correct to me other than the ArcTan[0,0] value which is undefined in Wikipedia and 0 by my definition. – dykes Apr 11 '18 at 23:13
• I see. I'll only note that it's more natural to use Piecewise[]: Piecewise[{{ArcTan[x, y], x != 0 || y != 0}}, 0] – J. M.'s technical difficulties Apr 12 '18 at 13:01