I have a 4th order polynomial equation and I need to find all the roots. A simple example:
from sympy import (Symbol,solve,I) a=4+5*I; b=3+7*I; c=12-56*I; d=33+56*I; e=345-67*I; x=Symbol('x') eq=a*x**4 + b*x**3 + c*x**2 + d*x +e solve(eq,x)
If a, b, c, d, e are purely real, then it works fine. But in my case, they are all complex numbers. Then I got a call:
PolynomialError: 'cannot return general quartic solution'
I see a similar problem and implement the fix: Description of the problem . Fix the problem
but it really doesn’t help. There is some strange problem, since now the call (as changed in the fix):
PolynomialError: Cannot determine if `-((12 - 56*I)/(4 + 5*I) - 3*(3 + 7*I)**2/(8*(4 + 5*I)**2))**2/12 + (3 + 7*I)*((33 + 56*I)/(4*(4 + 5*I)) + (3 + 7*I)*(3*(3 + 7*I)**2/(256*(4 + 5*I)**2) - (12 - 56*I)/(16*(4 + 5*I)))/(4 + 5*I))/(4 + 5*I) - (345 - 67*I)/(4 + 5*I)` is nonzero.
But to determine whether the expression above is nonzero is the simplest, so I don’t know where the problem is.
source share