I'm stuck with a really basic problem, and would appreciate help to understand what I am doing wrong.
The task is to find imaginary and real part of $$\Big(\frac{-1+ i \sqrt{3}}{2}\Big)^3$$
Solution so far:
$$z^n=re^{i \theta n}$$
$$r=|z| = \sqrt{\frac{1}{4}+\frac{3}{4}}=1$$
$$\theta = \arg(z)=\arctan\Big(\frac{y}{x}\Big)=\arctan\Big(\frac{\sqrt{3}/2}{-1/2}\Big)=\frac{-\pi}{3}$$
Which gives me that $$\displaystyle z^n=re^{i \theta n} = e^{-i\frac{3\pi}{3}} = e^{-i\pi}$$
The correct answer is $$e^{i\frac{2\pi}{3}}$$
What in the calculation of $\theta$ am I doing wrong?
Thanks!
There are two issues:
Firstly, $\arctan (-\sqrt{3}) = -\frac{\pi}{3}$, not $-\frac{\pi}{6}$ (perhaps you computed $\arctan\left(-\frac{1}{\sqrt{3}}\right)$ instead).
Secondly, $\arctan\frac{y}{x}$ only yields the argument of values with real positive part (and then provided that the branch of the argument has range containing the image $\left(-\frac\pi2, \frac\pi2\right)$ of $\arctan$). For points $x + i y$ with negative real part $x$, we can compute the argument with the formula $\arg (x + i y) = \arctan\frac{y}{x} + \pi$ (and then adding an integer multiple of $2 \pi$ if the choice of branch of $\arg$ makes it necessary). In our case, any branch will do, so we can take, e.g., $$\arg \frac{-1 + \sqrt{3}}{2} = \arctan \frac{\frac{\sqrt{3}}{2}}{\frac{-1}{2}} + \pi = \frac{2 \pi i}{3}.$$ Since the radial coordinate of $\frac{-1 + \sqrt{3}}{2}$ is $1$, $$\frac{-1 + \sqrt{3}}{2} = e^{2 \pi i / 3} .$$
Cf. atan2.