# Argument of a complex number with assumptions

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?

• 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? Jul 2 at 19:44
• 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 Jul 2 at 19:52
• Cos[y] can be negative. Jul 2 at 20:06
• 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? Jul 2 at 20:14

## 2 Answers

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,

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


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.