<s>[INST] What am I doing wrong in these quartic formula calculations? I was a bit surprised that there is a general formula for the roots of a quartic equation, so I decided to test Wikipedia's version of it myself. To my surprise, I have arrived at a correct answer only once in about five attempts, using only integer coefficients of factorizable polynomials.
I am testing the formula for the equation $(x-1)(x-2)(x-3)(x-4)=0$, which should obviously return 1, 2, 3, and 4. However, my calculations tell a different story:


*

*Expanding gives $x^4 - 10x^3 + 35x^2 - 50x + 24$. Therefore, $a = -10, b = 35, c = -50, d = 24$.

*$u$ is therefore equal to $\frac{3(-10)^2 - 8(35)}{12} = \frac{300 - 280}{12} = \frac{20}{12} = \frac{5}{3}$.

*$\Delta_0$ is $35^2 - 3(-10)(-50) + 12(24) = 1225 - 1500 + 288 = 13$.

*$\Delta_1$ is $2(35^3) - 9(-10)(35)(-50) + 27(-10)^2(24) + 27(-50)^2 - 72(35)(24)$, which works out to 70.

*The discriminant is $-\frac{\Delta_1^2 - 4\Delta_0^3}{27} = -\frac{-3888}{27} = 144$. Because it is positive, the equation must have either four real roots or four complex roots.

*$Q$ is equal to $\sqrt[3]{\frac{70 + \sqrt{-3888}}{2}} = \sqrt[3]{\frac{70 + 36i\sqrt{3}}{2}} = \sqrt[3]{35 + 18i\sqrt{3}}$.

*$v$ is $\frac{\left(\sqrt[3]{35 + 18i\sqrt{3}}\right)^2 + 13}{3\sqrt[3]{35 + 18i\sqrt{3}}}$. After rationalizing the denominator it becomes $\frac{1 + \sqrt[3]{35 - 18i\sqrt{3}}}{3}$.

*$w$ might make things even more complicated, but mercifully its numerator (and therefore value) is zero.


Placing these values into one of the final expressions for the formula gives
$$\frac{1}{4}\left(10 + 2\sqrt{\frac{6 + \sqrt[3]{35 - 18i\sqrt{3}}}{3}} \pm 2\sqrt{\frac{9 - \sqrt[3]{35 - 18i\sqrt{3}}}{3}}\right),$$
a number which is neither rational nor even fully real, and the other two roots are the same.
I expected that the error would become self-evident as I typed this question (which took a while, as you can imagine) — but it has not. So what is wrong with these calculations?
 [/INST] Everytime there is a complicated cube root or square root, there is a simplification that can occur.
For example, you can compute $(35+18i\sqrt 3)^{1/3}$ approximately in $\Bbb C$, or you can magically realize that $(-1-2i\sqrt 3)^3 = 35+18i\sqrt 3$ and so you can pick $Q = -1-2i\sqrt 3$ (don't try to find this cube root algebraically).
This should help you with the rest, and feel free to see what happens when you replace $Q$ with one of the other two cube roots.
</s>