def dmp_sqf_part(f, u, K):
 if (not u):
  return dup_sqf_part(f, K)
 if K.is_FiniteField:
  return dmp_gf_sqf_part(f, u, K)
 if dmp_zero_p(f, u):
  return f
 if K.is_negative(dmp_ground_LC(f, u, K)):
  f = dmp_neg(f, u, K)
 gcd = dmp_gcd(f, dmp_diff(f, 1, u, K), u, K)
 sqf = dmp_quo(f, gcd, u, K)
 if K.has_Field:
  return dmp_ground_monic(sqf, u, K)
 else:
  return dmp_ground_primitive(sqf, u, K)[1]

def dmp_sqf_part ( f , u , K ) : if ( not u ) : return dup_sqf_part ( f , K ) if K . is_FiniteField : return dmp_gf_sqf_part ( f , u , K ) if dmp_zero_p ( f , u ) : return f if K . is_negative ( dmp_ground_LC ( f , u , K ) ) : f = dmp_neg ( f , u , K ) gcd = dmp_gcd ( f , dmp_diff ( f , 1 , u , K ) , u , K ) sqf = dmp_quo ( f , gcd , u , K ) if K . has_Field : return dmp_ground_monic ( sqf , u , K ) else : return dmp_ground_primitive ( sqf , u , K ) [ 1 ]
returns square-free part of a polynomial in k[x] .