# Analytic solution for a quartic polynomial

I'm trying to use a generic solution with an analytic method for quartic polynomials. I am only interested in finding the real roots.
Based on the solutions given by Wolfram|Alpha, and since the formula given in a previous question was apparently not correct, I came up with the following simplification ($a$, $b$, $c$, $d$ and $e$ are reals):

\begin{align} &ax^4 + bx^3 + cx^2 + dx + e = 0\\ \\ p_1 &= 2c^3 - 9bcd + 27ad^2 + 27b^2e - 72ace\\ p_2 &= 12ae - 3bd + c^2\\ p_3 &= (\sqrt{p_1^2 - 4p_2^3} + p_1)^{1/3}\\ p_4 &= \frac{1}{3 \sqrt{2} ap_3}\\ p_5 &= \frac{\sqrt{2} p_2}{3ap_3}\\ p_6 &= \sqrt{\frac{b^2}{4a^2} + p_4 + p_5 - \frac{2c}{3a}}\\ \\ x &= \pm \frac{p_6}{2} \pm \frac{1}{2} \sqrt{\frac{b^2}{2a^2} - \frac{- \frac{b^3}{a^3} + \frac{4bc}{a^2} - \frac{8d}{a}}{4p_6} - p_4 - p_5 - \frac{4c}{3a}} - \frac{b}{4a} \end{align}

Yet when I try to apply it with an example such as

\begin{equation} a = 3, b = 6, c = -123, d = -126, e = 1080 \end{equation}

which should give me four real roots:

\begin{equation} x = -6, x = -4, x = 3, x = 5 \end{equation}

but I end up with a complex number in $p_3$, which I then need to get the cube root of.

With another example:

\begin{equation} a = -20, b = 5, c = 17, d = -29, e = 87 \end{equation}

which should give me two real roots, I get four real roots when I try to apply my formula, none of them being correct.

Also I do not see with that formula how I could end up with two real roots and two complex roots. So is there something wrong with my interpretation? Is there no way to solve a quartic polynomial that way?

• Most of the time complex numbers are unavoidable even when finding real roots. This is true even for cubics. – EuYu Oct 16 '12 at 15:17
• Why is my second example returning me 4 wrong, real roots then? It should give me 2 real and 2 complex roots. – ValV Oct 16 '12 at 16:40