Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 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 at 13:24

1 Answer 1

up vote 0 down vote accepted

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?

share|improve this answer
    
Very good. Thank you. –  To Be Jun 21 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 at 14:09

Your Answer

 
discard

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.