Here's another trick I use sometimes to simplify an angle: Take the cosine and sine of the expression. Somehow, although I cannot give an example other than the one at hand, I have the impression that Mathematica deals with sines and cosines more robustly than tangent or its inverse. Maybe not much more robustly, but there seems to be an unequal ability. As you say, it would be better if this were done automatically.
expr = ComplexExpand[
Arg[x + I y] - 2 ArcTan[y/(x + Sqrt[x x + y*y])],
TargetFunctions -> {Re, Im}];
expr = FullSimplify[Through[{Cos, Sin}[expr]]];
ArcTan @@ expr
(* 0 *)
Or, if you want to enhance FullSimplify
:
sincosSimp[t_] := ArcTan @@ FullSimplify[Through[{Cos, Sin}[t]]];
FullSimplify[
Arg[x + I y] - 2 ArcTan[y/(x + Sqrt[x x + y*y])] //
ComplexExpand[#, TargetFunctions -> {Re, Im}] &,
TransformationFunctions -> {Automatic, sincosSimp}]
(* 0 *)
Again, one has to use ComplexExpand
, this time to convert Arg[x + I y]
to ArcTan[x, y]
. FullSimplify[]
, with x
and y
assumed to be real, won't do it. (After ComplexExpand
, the assumption is no longer necessary.)