4
$\begingroup$

I have an equation such as:

a*z^2 + b*(z - c)^2 == d 

where z is a complex variable and a, b, c, d are all complex parameters. I want to put x+I*y instead of z and decompose this equation into two pure real and imaginary part for further analysis, but I don't know how to do it by Mathematica! Can anybody help me?

$\endgroup$
7
$\begingroup$

Try:

ComplexExpand[a*z^2 + b*(z - c)^2, {_}]

Or to get a somewhat shorter result:

ComplexExpand[a*z^2 + b*(z - c)^2, {_}] /. a_ + Complex[0, 1] b_ :> Simplify[a] + I Simplify[b]
(*
 -Im[c]^2 Re[b] - Im[z]^2 (Re[a] + Re[b]) + Re[b] Re[c]^2 - 
  2 Re[b] Re[c] Re[z] + Re[a] Re[z]^2 + Re[b] Re[z]^2 + 
  2 Im[b] Im[c] (-Re[c] + Re[z]) + 
  2 Im[z] (Im[c] Re[b] + Im[b] (Re[c] - Re[z]) - Im[a] Re[z]) + 
 I (Im[b] (-Im[c]^2 + 2 Im[c] Im[z] - Im[z]^2 + (Re[c] - Re[z])^2) + 
    Im[a] (-Im[z]^2 + Re[z]^2) + 2 (Im[c] Re[b] (Re[c] - Re[z]) + 
    Im[z] (Re[a] Re[z] + Re[b] (-Re[c] + Re[z]))))
*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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