// square -free-decomposition of p=p1*p2^2*p3^3*...returns [p1,p2,p3..] public Algebraic[] square_free_dec(Variable var) throws JasymcaException { if (!dependsmult(var)) return null; Algebraic dp = deriv(var); Algebraic gcd_pdp = poly_gcd(dp); Algebraic q = polydiv(gcd_pdp); Algebraic p1 = q.polydiv(q.poly_gcd(gcd_pdp)); if (gcd_pdp instanceof Polynomial && ((Polynomial) gcd_pdp).dependsmult(var)) { Algebraic sq[] = ((Polynomial) gcd_pdp).square_free_dec(var); Algebraic result[] = new Algebraic[sq.length + 1]; result[0] = p1; for (int i = 0; i < sq.length; i++) result[i + 1] = sq[i]; return result; } else { Algebraic result[] = {p1}; return result; } }