Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SymPy cannot solve polynomial equation of 4th order

I have an polynomial equation of 4th order and I need to find all roots. 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 pure real, then it work just fine. But in my case all of them are complex numbers. Then i did get call:

PolynomialError: 'cannot return general quartic solution'

I find kind of similar issue, and implement the fix: Description of the issue. Fix of the issue

but it doesn't really help. There is some kind of strange problem, as now the call is (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 if expression above is nonzero is the most simplest thing, so don't know where the problem could be.

like image 334
K4stan Avatar asked Feb 06 '15 13:02

K4stan


1 Answers

Upgrade to the most recent version of SymPy which supports arbitrary quartic solutions.

like image 117
smichr Avatar answered Sep 29 '22 22:09

smichr