sympy/sympy — pull request #8463 by smichr (2014-11-17 19:48:49+00:00)
Title: 8438: implement general cubic solution

Interestingly enough, the solution below does not work (or else I
have copied/interpreted something wrong or there is a typo on the site):

** eqns (54)-(56) from http://mathworld.wolfram.com/CubicFormula.html

f = Poly([1, -S(3)/2 - 7*I/2, -2, -3], x)
_, a2, a1, a0 = f.monic().all_coeffs()
coeff = I*sqrt(3)/2
Q = (3*a1 - a2**2)/9
R = (9*a2*a1 - 27*a0 - 2*a2**3)/54
D = Q**3 + R**2
_S = root(R + sqrt(D), 3)
T = root(R - sqrt(D), 3)
B = _S + T
A = _S - T
r = -a2/3 - B/2
bad = [-a2/3 + B, r + coeff*A, r - coeff*A]