# How to get the complex number out of the polar form

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.

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

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

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

• 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. – jarryd Jan 3 '16 at 8:31
• 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 :) – jarryd Jan 3 '16 at 8:50
• 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! :) – Blogger Jan 3 '16 at 8:58
• yeah it does. Thanks :) – jarryd Jan 4 '16 at 18:42

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?

$$\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}$

• $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). – David Z Jan 3 '16 at 11:55
• Sorry I meant old fashioned electricity courses we used to have at High School. – marwalix Jan 3 '16 at 13:31
• @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. – Masked Man Jan 3 '16 at 14:57
• @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$. – David Z Jan 3 '16 at 15:01
• @MaskedMan: and $\mathbf{j}$ is actually used for current density in physics. – leftaroundabout Jan 3 '16 at 18:05