5
$\begingroup$

How does one get the complex number out of this equation?

$$\Large{c = M e^{j \phi}}$$

I would like to write a function for this in C but I don't see how I can get the real and imaginary parts out of this equation to store it in a C structure.

$\endgroup$
  • $\begingroup$ $e^{it} = \cos t + i \sin t$ $\endgroup$ – user296602 Jan 3 '16 at 8:27
2
$\begingroup$

Use Euler's relation $$c = M\cos\phi + jM\sin\phi$$

enter image description here

So the real part is $M\cos\phi$ and imaginary part is $M\sin\phi$ I think that's what you want right? :)

$\endgroup$
  • $\begingroup$ True I could do that, I was just wondering how the real and imaginary part can be extracted from that formula directly if passed in those arguments. I'll just use the trig formula in the function. $\endgroup$ – jarryd Jan 3 '16 at 8:31
  • $\begingroup$ Yes, thanks for the updated answer. I think my question was pretty pointless as the polar form is the way it is. My uncertainty was more regarding how the math formula can be represented with a programming function. Using Euler's relation solves the problem, thanks :) $\endgroup$ – jarryd Jan 3 '16 at 8:50
  • $\begingroup$ Oh you're going to get that $M$ and $\phi$ as input arguments in a programming function? Euler's relation does the job right? :) Good luck! :) $\endgroup$ – Blogger Jan 3 '16 at 8:58
  • $\begingroup$ yeah it does. Thanks :) $\endgroup$ – jarryd Jan 4 '16 at 18:42
3
$\begingroup$

In that form, the expresion is equivalent to the vector, in $\mathbb{R}^2$, with angle $\phi$ and length $M$. Now, with this information, can you continue?

$\endgroup$
2
$\begingroup$

$$\mathcal{R}(c)=M\cdot\cos{\phi}$$ $$\mathcal{I}(c)=M\cdot\sin{\phi}$$

Assuming that $j^2=-1$ (Physics notation). If we follow a math notational convention where $i^2=-1$ and $j=e^{{2i\pi\over 3}}$ is a complex root of unity we just replace in the above $\phi$ by $\phi+{2i\pi\over 3}$

$\endgroup$
  • 3
    $\begingroup$ $j^2 = -1$ was engineering notation, I thought. I'm a physicist and I've never used it nor seen anyone in my field use it. We've all standardized on $i$ for the imaginary unit (and $j$ has no special meaning with regard to complex numbers). $\endgroup$ – David Z Jan 3 '16 at 11:55
  • $\begingroup$ Sorry I meant old fashioned electricity courses we used to have at High School. $\endgroup$ – marwalix Jan 3 '16 at 13:31
  • $\begingroup$ @DavidZ I imagine even a physics course would need to use 'j' when dealing with electrical networks having reactive components, since 'i' could be confused with the conventional notation for current. I am curious how you deal with that. $\endgroup$ – Masked Man Jan 3 '16 at 14:57
  • $\begingroup$ @MaskedMan Current never appears in an exponent. On top of that, we typically use capital $I$ for current, and/or write it as a function of time, $I(t)$ or $i(t)$. Throughout all of this, the imaginary unit is always $i$. $\endgroup$ – David Z Jan 3 '16 at 15:01
  • $\begingroup$ @MaskedMan: and $\mathbf{j}$ is actually used for current density in physics. $\endgroup$ – leftaroundabout Jan 3 '16 at 18:05

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.