Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to find the real and imaginary parts of $x + y$ in terms of polar coordinates.

Here is code:

ComplexExpand[Re[x + y], {x, y}, TargetFunctions -> {Abs, Arg}]

How can I add the assumption that $Abs[x]$ equals to $Abs[y]$?

For example this code does not work:

ComplexExpand[Re[x + y], {x, y}, TargetFunctions -> {Abs, Arg}, 
Assumptions -> Abs[x] == Abs[y]]
share|improve this question
By the above assumption, I expect to obtain: Re[x + y] = Abs[x] (Cos[Arg[x]] + Cos[Arg[y]]) – To Be Jun 21 '14 at 13:23
Or, how can I change the code to obtain Re[x + y] = Abs[x] (Cos[Arg[x]] + Cos[Arg[y]]), by the assumption that Abs[x] = Abs[y]? – To Be Jun 21 '14 at 13:24
up vote 1 down vote accepted


  ComplexExpand[Re[x + y], {x, y}, TargetFunctions -> {Abs, Arg}], 
  Assumptions -> Abs[x] == Abs[y]]
Abs[y] (Cos[Arg[x]] + Cos[Arg[y]])

work for you?

share|improve this answer
Very good. Thank you. – To Be Jun 21 '14 at 13:47
@To Be - The algorithms give Abs[y] rather than the equivalent Abs[x]; however, if the difference is important to you, you could try playing with the ComplexityFunction for FullSimplify or just use a rule /. Abs[y] -> Abs[x] – Bob Hanlon Jun 21 '14 at 14:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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