solveset/solve 4th order polynomial roots

Viewed 201

I am experimenting with sympy and got an unexpected result when trying to solve the 4th order polynomial x**4+b*x+c=0 which reduces to x**4-1=0 when b=0,c=-1, its roots being {−1,1,−,}. Yet this is what I am getting from python3.8.1:

from sympy import *
init_printing()
from sympy import __version__ as sympy_version
sympy_version
>>'1.6.2'
x,b,c,r,r1,e,e1=symbols('x,b,c,r,r1,e,e1')
e=sympify('x**4+b*x+c')
r=solveset(e,'x')
e1=e.subs({b:0,c:-1})
r1=solveset(e1)
r.subs({b:0,c:-1}),r1
>>({0}, {−1,1,−,})

Why solving the general equation and then substituting the values for b and c fails? What I am doing wrong?

I get the same results with python 2.7.5 sympy 0.7.6.1 and the online sympy system.

1 Answers

Based on the remarks and insights presented by @Maelstrom and @Oscar-Benjamin in the above comments, the answer given by sympy is the one quoted in the literature as the general formula for a quatric equation. But this formula is valid subject to conditions that are complicated functions of the polynomial coefficients. The answer returned by sympy does not include these conditions. I do not doubt that there are good reasons that sympy does so, nevertheless the answer is, in my opinion, unusable.
It so happens that b=0,c=-1 violate these conditions and the general formula evaluates to numbers that are not roots.
From a practical point, one should first substitute the actual values to the polynomial and then solve for its roots.

Related