check two polynomials equivalence