# Real and imaginary parts of a complex number

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]]

• 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

Would

Simplify[
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?

• 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