1
$\begingroup$

I have an equation which consists of a real and complex quantity I just wanted to separate it out and form two new equations.

e[1] = ComplexExpand[
   L1*Exp[I*x1] + L2*Exp[I*x2] - L4*Exp[I*x4] - L3*Exp[I*x3]];
$\endgroup$
3
  • 2
    $\begingroup$ Have your tried ReIm? $\endgroup$ Commented Feb 8, 2019 at 11:49
  • $\begingroup$ I have Tried Collect[e[1],I] $\endgroup$
    – acoustics
    Commented Feb 8, 2019 at 11:49
  • $\begingroup$ in short: ComplexExpand@ ReIm[L1*Exp[I*x1] + L2*Exp[I*x2] - L4*Exp[I*x4] - L3*Exp[I*x3]] $\endgroup$
    – rmw
    Commented Feb 8, 2019 at 13:31

1 Answer 1

4
$\begingroup$

Try

ComplexExpand[{Re[#], Im[#]} &[L1*Exp[I*x1] + L2*Exp[I*x2] - L4*Exp[I*x4] - L3*Exp[I*x3]],
TargetFunctions -> {Re, Im}]
(*{L1 Cos[x1] + L2 Cos[x2] - L3 Cos[x3] - L4 Cos[x4], 
L1 Sin[x1] + L2 Sin[x2] - L3 Sin[x3] - L4 Sin[x4]}*)
$\endgroup$
1
  • 1
    $\begingroup$ Or more compactly, ComplexExpand[ ReIm[L1*Exp[I*x1] + L2*Exp[I*x2] - L4*Exp[I*x4] - L3*Exp[I*x3]]] $\endgroup$
    – Bob Hanlon
    Commented Feb 8, 2019 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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