Complex roots of non-squarefree real polynomial
Dear all, I need in my script the maximum of the absolute value of the roots of a polynomial. I don't know the polynomial the user will introduce, so it may well be non squarefree and with non-integer coefficients. Here is something that baffled me for some time:
x = var('x')
R0X = PolynomialRing(RealField(40), x)
P0 = 1 + 2*x + x ^2
P = R0X( P0)
complex_roots(P)
--> ok, good result
P0 = 1-2*x-7*x^2-4*x^3 # -4 * (x-1/4) * (x + 1)^2
P = R0X( P0)
complex_roots(P)
--> waiting, waiting ....
The mystery is not so hard to pierce, I think:
P.squarefree_decomposition()
sage: -4.0000*x^3 - 7.0000*x^2 - 2.0000*x + 1.0000
But then, I still have my initial problem! I can use some apriori bound for these roots. I'm still unhappy of not being able to get a better numerical approximation --
Many thanks for your lights! Olivier