I am trying to calculate the argument of a complex number:

Arg[Cos[y]*Exp[I x]]

where both x and y are real. The solution is clearly x, but I can't get it with Mathematica! I tried adding an assumption

Simplify[Arg[Cos[y]*Exp[I x]], y > 0]

Assuming[{x \[Element] Reals, y \[Element] Reals}, Arg[Cos[y]*Exp[I x]]]

but it doesn't work. Anyone has an idea? How can I get Mathematica to output x?

  • 2
    $\begingroup$ The solution isn't $x$, it's $(x \text{ mod } 2\pi) - \pi$ under Mathematica's conventions. Perhaps adding the assumption - \Pi < x < \Pi will help? $\endgroup$ Jul 2, 2022 at 19:44
  • $\begingroup$ Thanks for your comment. I tried Simplify[Arg[Cos[y]*Exp[I x]], {y > 0, -Pi < x < Pi}], but I still don't get the answer x mod 2Pi $\endgroup$
    – Riccardo
    Jul 2, 2022 at 19:52
  • $\begingroup$ Cos[y] can be negative. $\endgroup$
    – user293787
    Jul 2, 2022 at 20:06
  • $\begingroup$ That's a good point: I run Assuming[{0 < x < 0.1, 0 < y < 0.1}, Refine[Arg[Cos[y]*Exp[I x]]]] and now I get Arg[E^(I x)] as a solution. How do I get x as an output now? $\endgroup$
    – Riccardo
    Jul 2, 2022 at 20:14

2 Answers 2


Plot it to see it

Plot3D[{x, Arg[Cos[y]*Exp[I x]]}, {x, -7, 7}, {y, -5, 5}, 
 PlotPoints -> 100, PlotStyle -> {Red, Blue}]

FullSimplify[Arg[Cos[y]*Exp[I x]], {-Pi/2 < y < Pi/2, -Pi < x < Pi}]

(*   x   *)

As pointed out by @Akku14,


does give x as requested. The assumptions on y are such that Cos[y] is positive. But if you change the assumptions a bit, it may not always produce exactly what you want. For example, if you say modify the second inequality to Pi/2<y<3*Pi/2 where Cos[y] is negative, it will not evaluate Arg. So you are right that Arg is a function that can be tricky to deal with in a symbolic calculation.

The Arg-documentation acknowledges this with "Arg[z] is left unevaluated if z is not a numeric quantity". Almost all examples in the documentation are for numeric input.

There are various ways to deal with this in practice. You could use an explicit replacement such as

yourExpression /. {Arg[Exp[I*x]]->x}

to achieve this particular transformation. Mathematica cannot do this automatically because it is only true with certain assumptions about x, but an explicit replacement is one way to bring the extra information that you have about your x into the symbolic calculation and move on. See here for more info on transformations.


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.