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?