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.
ComplexExpand[Abs[a + b I]]

Gives

$\sqrt{a^2 + b^2 }$

ComplexExpand[Abs[a + b I]^2]

On the other hand gives

Abs[a + I b]^2

How can I let it evaluate to $a^2 + b^2$ instead?

share|improve this question
4  
Try ComplexExpand[Abs[a + b I]^2, TargetFunctions -> {Re, Im}]. –  b.gatessucks Apr 23 '13 at 15:45
2  
FullSimplify[Abs[a + b I]^2, (a | b) \[Element] Reals] works too. –  Szabolcs Apr 23 '13 at 15:54
    
I have found that the TargetFunctions approach usually works better for more complicated arguments. Sometimes, running things through FullSimplify is slow and doesn't get you much. –  Kevin Driscoll Apr 23 '13 at 18:39
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.