Maybe it is a very stupid question but I am having trouble with summing complex numbers in Mathematica. I have

q = l1 E^(2 π I t1) + l2  E^(2 π I t2)

where l1, l2 t1, and t2 are known real numbers. I obtain an answer which is a set of four complex numbers.

I think it sums all the components one by one (Minkowski sum?), and I want just to sum two complex numbers to obtain a third one. What function should I use?

  • 3
    $\begingroup$ You might want to look at ComplexExpand[]. $\endgroup$ – J. M.'s ennui Jul 11 '15 at 12:29
  • $\begingroup$ What do you mean by "2[Pi]"? $\endgroup$ – Peltio Jul 11 '15 at 12:30
  • $\begingroup$ @Peltio, Markdown strips backslashes, unfortunately. I've fixed it. $\endgroup$ – J. M.'s ennui Jul 11 '15 at 12:37
  • $\begingroup$ q // ExpToTrig // Simplify is equivalent to q//ComplexExpand in this case. $\endgroup$ – Bob Hanlon Jul 11 '15 at 13:16

Since l1, l2, t1, t2 are known, you just need to plug them in:

q=l1 E^(2 \[Pi] I t1) + l2 E^(2 \[Pi] I t2) /. {l1->0.2, t1->0.1, l2->5, t2->-1}

gives 5.1618 + 0.117557 I

   q1 = l1 E^(2 \[Pi] I t1) + l2 E^(2 \[Pi] I t2)

        q2 = q1 // ExpToTrig

        (Drop[q2, 2] // Factor) + Drop[q2, -2]

        (*  E^(2 I \[Pi] t1) l1 + E^(2 I \[Pi] t2) l2

        l1 Cos[2 \[Pi] t1] + l2 Cos[2 \[Pi] t2] + I l1 Sin[2 \[Pi] t1] + 
         I l2 Sin[2 \[Pi] t2]

        l1 Cos[2 \[Pi] t1] + l2 Cos[2 \[Pi] t2] + 
         I (l1 Sin[2 \[Pi] t1] + l2 Sin[2 \[Pi] t2])  *)

Have fun!


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.