SymPy allows us to define and perform various operations on polynomials. We can also find the roots of polynomials. We have already covered the simplify
, expand
, factor
, and solve
methods. These methods also perform the functionalities for polynomials. To check for the equality of two polynomials, we should use the simplify
function:
from sympy import * p, q = symbols ('p q') p = (x+4)*(x+2) q = x**2 + 6*x + 8 p == q # Unsuccessful p - q == 0 # Unsuccessful simplify(p - q) == 0