Hello Everyone,
I have noted some stranges behaviours of solve for polynomial in my use of sympy.
In case of 4th degree polynomial with 2 two conjugates solutions, solve return only two of the four solutions.
The problem seems to appear only with real coefficients, integer polynomial solutions are fine.
On the other side, sympy roots always gives the good answer.
Example :
>>> import sympy as sy
>>> s = sy.S("s")
>>> expr = 4.0*s**4 + 3.0*s**3 + 3.0*s**2 - 4.0*s + 4.0
>>> rt= sy.roots(expr)
>>> sl= sy.solve(expr)
>>> print sl,"\n",rt
[0.490766420298022 - 0.526081774461482*I, 0.490766420298022 + 0.526081774461482*I]
{-0.865766420298022 - 1.08737810369128*I: 1, 0.490766420298022 - 0.526081774461482*I: 1, -0.865766420298022 + 1.08737810369128*I: 1, 0.490766420298022 + 0.526081774461482*I: 1}
Similarly, solving for 5th degree polynomial return strange error :
>>> sy.solve(s**5+s**4-1.0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sympy/sympy/solvers/solvers.py", line 958, in solve
solution = nfloat(solution, exponent=False)
File "sympy/sympy/core/function.py", line 2219, in nfloat
return type(expr)([nfloat(a, n, exponent) for a in expr])
File "sympy/sympy/core/function.py", line 2235, in nfloat
rv = rv.xreplace(dict(reps))
File "sympy/sympy/core/basic.py", line 1106, in xreplace
return self.func(*args)
File "sympy/sympy/polys/rootoftools.py", line 62, in __new__
raise PolynomialError("only univariate polynomials are allowed")
sympy.polys.polyerrors.PolynomialError: only univariate polynomials are allowed
Should I had an issue in the tracker or this problems are already known ?
Regards,
Alexandre.