How to solve this cubic equation (where I must take the square root of a negative)? I am trying to solve the following set of equations for $L'$ as described in this publication excerpt:



So basically, to re-write that, I have the following series of equations:
$a=X/2$
$b=-(75X^2 + 147Y^2)/80$
$c = -9X^3/16$
$P = 2a^3−9ab+ 27c$
$Q = P^2 -4(a^2-3b)^3$
$w_1=−0.5 +\frac{i\sqrt{3}}{2}$
$w_2=−0.5 -\frac{i\sqrt{3}}{2}$
Which lead to the following three possible solutions:
$L'_1 = -\frac{1}{3} * [a+\sqrt[3]{0.5*(P+\sqrt{Q})} +\sqrt[3]{0.5*(P-\sqrt{Q})}]$
$L'_1 = -\frac{1}{3} * [a+w_2\sqrt[3]{0.5*(P+\sqrt{Q})} +w_1\sqrt[3]{0.5*(P-\sqrt{Q})}]$
$L'_1 = -\frac{1}{3} * [a+w_1\sqrt[3]{0.5*(P+\sqrt{Q})} +w_2\sqrt[3]{0.5*(P-\sqrt{Q})}]$
I am now trying to solve $L'$, but I'm not actually sure how to do it.
My problem is for any input of $X$ or $Y$, $P$ I believe can end up positive or negative, but $Q$ is always a negative.
So let's say hypothetically $P = 2$ and $Q = -3$, then how do you solve:
$\sqrt[3]{0.5*(P-\sqrt{Q})} = \sqrt[3]{1-0.5*i\sqrt{3}}$
What would be the next step?
Basically, I don't know how to solve these equations if $Q$ is negative or if $0.5*(P-\sqrt{Q})$ is negative. I don't know much about complex math. I've used Euler's formula in other situations but I'm not sure here.
Any help? Thanks.
 A: For this equation, I should strongly recommend to use the trigonometric method for three real roots since
$$\Delta=6914880 \left(175 X^4 Y^2+230 X^2 Y^4+147 Y^6\right) >0 \quad \forall X,Y$$
$$p=-\frac{49}{240} \left(5 X^2+9 Y^2\right)\qquad\qquad  q=\frac{49}{4320} X \left(27 Y^2-35 X^2\right)$$ which gives for the roots
$$L'_{k}=-\frac X 6+\frac{7 \sqrt{5 X^2+9 Y^2}}{6 \sqrt{5}}\times $$ $$\cos \left(\frac{2 \pi  k}{3}-\frac{1}{3} \cos ^{-1}\left(-\frac{\sqrt{5} X
   \left(27 Y^2-35 X^2\right)}{7 \left(5 X^2+9 Y^2\right)^{3/2}}\right)\right)$$ with $k=0,1,2$.
A: In the next step, you want the cube root of the complex number $z = 1-i\sqrt{3}/2$. First express this number in the form $z = re^{i\theta}$ using Euler's identity. For a number $z = a + i b$ we have $ r = \sqrt{a^2 + b^2}$ and $\theta = \tan^{-1}(b/a)$:
$$ z = \sqrt{1^2 + (\sqrt{3}/2)^2} e^{i\tan^{-1}(-\sqrt{3}/2) + 2\pi i n} = \frac{1}{2}\sqrt{7}e^{i \tan^{-1}(\sqrt{3}/2) + i 2\pi n} .$$
Here $n$ is an arbitrary integer which accounts for the periodicity of $e^{i x}$.
Then you can take the cube root:
$$ z^{1/3} = \frac{7^{1/6}}{2^{1/3}} e^{i \tan^{-1}(-\sqrt{3}/2)/3 + i 2 \pi n/3} =  \frac{7^{1/6}}{2^{1/3}} \big[ \cos( \tan^{-1}(-\sqrt{3}/2)/3) + i \sin (\tan^{-1}(-\sqrt{3}/2)/3)\Big] e^{i 2 \pi n/3} $$
which you can simplify as desired. Notice it's multi-valued ($n = 0, \pm 1, \dots$). These different values are branches.
