clear all
; The 4 solutions for x in the quartic equation:
0 = x^4 + a1 x^3 + a2 x^2 + a3 x + a4
; Currently the following gives 8 solutions, only 4 are correct.

q=(3ca2-ca1^2)/9
r=(9ca1*ca2-27ca3-2ca1^3)/54
s=(r+(q^3+r^2)^.5)^(1/3)
t=(r-(q^3+r^2)^.5)^(1/3)
y1=s+t-ca1/3
eliminate s t q r
replace ca1 with -a2
replace ca2 with a1*a3-4a4
replace ca3 with 4a2*a4-a3^2-a1^2*a4
x^2+.5*(a1+/-(a1^2-4a2+4y1)^.5)*x+.5*(y1+/-(y1^2-4a4)^.5)=0
x
eliminate y1
clear 2-6
