For some reason Mathematica does not properly simplify this expression:

In[7]:= FullSimplify[ArcTan[-Re[x + z], y], (x | y | z) \[Element] Reals]
Out[7]= ArcTan[-Re[x + z], y]

Obviously, if x and z are real, then so is x+z, so Re[x + z] should be replaced by x + z. Strangely enough, dropping any small part of the input fixes the problem, here are some examples.
No minus sign:

In[8]:= FullSimplify[ ArcTan[Re[x + z], y], (x | y | z) \[Element] Reals]
Out[8]= ArcTan[x + z, y]

No z:

In[9]:= FullSimplify[ArcTan[-Re[x], y], (x | y | z) \[Element] Reals]
Out[9]= ArcTan[-x, y]

No y:

In[10]:= FullSimplify[ArcTan[-Re[x + z]], (x | y | z) \[Element] Reals]
Out[10]= -ArcTan[x + z]

Of course I can just drop the Re function manually, but this is just a small fragment of the actual expression I'm trying to simplify, and I would like to avoid going though the whole expression looking for this specific pattern.
Anyone knows how to fix this? Is this a bug or what? (I'm using version

  • $\begingroup$ It also doesn't work with FullSimplify[{-Re[x + z], 0}, (x|z) \[Element] Reals]. $\endgroup$
    – celtschk
    Apr 11, 2012 at 14:27
  • 1
    $\begingroup$ Simplify[Re[x + z], Assumptions -> {x \[Element] Reals, y \[Element] Reals, z \[Element] Reals}] does give x+z so it has to do with ArcTan $\endgroup$ Apr 11, 2012 at 14:27
  • $\begingroup$ ComplexExpand doesn't drop it either. $\endgroup$
    – Szabolcs
    Apr 11, 2012 at 14:37
  • $\begingroup$ FullSimplify[ArcTan[-(y/Re[x + z])], Assumptions -> {x + z > 0, y [Element] Reals}] also works. $\endgroup$ Apr 11, 2012 at 14:37
  • $\begingroup$ @celtschk - you're right, the ArcTan is redundant $\endgroup$
    – Joe
    Apr 11, 2012 at 14:44

2 Answers 2


The problem is due to Mathematica thinking that the version with the Re[] is actually simpler. This is because the default complexity function is more or less LeafCount[], and

In[332]:= ArcTan[-Re[x+z],y]//FullForm
Out[332]//FullForm= ArcTan[Times[-1,Re[Plus[x,z]]],y]


In[334]:= ArcTan[-x-z,y]//FullForm
Out[334]//FullForm= ArcTan[Plus[Times[-1,x],Times[-1,z]],y]

Here is a function that counts leaves without penalizing negation:

In[382]:= f3[e_]:=(LeafCount[e]-2Count[e,Times[-1,_],{0,Infinity}])
Out[383]= {1,3,1,1}

If you tell mathematica to simplify using this complexity function then you get the expected result:


Out[375]= ArcTan[-x-z,y]

  • 1
    $\begingroup$ This is exactly the answer I got from Wolfram support. It's pretty amazing that this quirky behavior actually has an explanation. I think that in the root of this is the fact the Mathematica can't have an expression of the form -(x+y) without automatically expanding it. Having some function in the middle like -Re[x+y] allows multiplying by -1 only once. $\endgroup$
    – Joe
    Apr 13, 2012 at 11:12
  • $\begingroup$ It is a nice example showing that the concept of simplifying something is actually pretty complicated. $\endgroup$
    – bill s
    Mar 21, 2018 at 15:30

I think this is a bug.

Close enough expressions yield better results, e.g.

             ArcTan[ -# Re[x + z], y], (x | y | z) \[Element] Reals
            ] ===
             ArcTan[ -# (x + z), y] & /@
  { 1.0,   1, Sqrt[1.], Exp[0.], 1 - 0., 2, a}
{True, False, True, True, True, True, True}

The problem seems to be specific for a factor -1 before Re[x + z], other factors appear to give what we would expect. If there is ArcTan[-a Re[x + z], y] in the expression it works well. It should be noted that the same issue comes with Simplify and that the problem has nothing to do with ArcTan, because :

(FullSimplify[-# Re[x + z], (x | y | z) \[Element] Reals]
         ===  -# (x + z)) & /@ 
  { 1.0,  1, Sqrt[1.], Exp[0.], 1 - 0., 2, a}
{True, False, True, True, True, True, True}

To fix the problem you could use e.g. Refine instead of FullSimplify,

Refine[ ArcTan[ -Re[x + z], y], (x | y | z) \[Element] Reals]
ArcTan[-x - z, y]


Another way to deal with similar expressions wolud be hiding a minus sign into Re, e.g.

Re[-(x + z)] instead of -Re[x + z].

Sometimes a more flexible way would be some kind of replacement, i.e. setting ArcTan[-a Re[x + z], y]] wherever in expr one finds ArcTan[- Re[x + z], y]] and then expr /. a->1

FullSimplify[ ArcTan[ -a Re[x + z], y], (x | y | z) \[Element] Reals] /. a -> 1
FullSimplify[ArcTan[ Re[-(x + z)], y], (x | y | z) \[Element] Reals]
ArcTan[-x - z, y]
ArcTan[-x - z, y] 
  • 2
    $\begingroup$ I submitted a bug report with Wolfram support, I will update here if there are news. $\endgroup$
    – Joe
    Apr 12, 2012 at 7:10
  • $\begingroup$ I got a response - see @Lev-Bishop's answer $\endgroup$
    – Joe
    Apr 13, 2012 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.