I'm using sympy to solve a polynomial:
x = Symbol('x')
y = solve(int(row["scaleA"])*x**3 + int(row["scaleB"])*x**2 + int(row["scaleC"])*x + int(row["scaleD"]), x)
y is a list of possible solutions. However, I need to ignore the imaginary ones and only use the real solutions. Also, I would like the solution as a value not an expression. Right now it looks like:
[-2/3 - 55**(1/3)*(-1/2 - sqrt(3)*I/2)/3, -2/3 - 55**(1/3)*(-1/2 + sqrt(3)*I/2)/3, -55**(1/3)/3 - 2/3]
I need the last expression's value (-2.22756). Are there functions in sympy to simplify this?