def dup_sqf_norm(f, K):
 if (not K.is_Algebraic):
  raise DomainError('ground domain must be algebraic')
 (s, g) = (0, dmp_raise(K.mod.rep, 1, 0, K.dom))
 while True:
  (h, _) = dmp_inject(f, 0, K, front=True)
  r = dmp_resultant(g, h, 1, K.dom)
  if dup_sqf_p(r, K.dom):
   break
  else:
   (f, s) = (dup_shift(f, (- K.unit), K), (s + 1))
 return (s, f, r)

def dup_sqf_norm ( f , K ) : if ( not K . is_Algebraic ) : raise DomainError ( 'ground domain must be algebraic' ) ( s , g ) = ( 0 , dmp_raise ( K . mod . rep , 1 , 0 , K . dom ) ) while True : ( h , _ ) = dmp_inject ( f , 0 , K , front = True ) r = dmp_resultant ( g , h , 1 , K . dom ) if dup_sqf_p ( r , K . dom ) : break else : ( f , s ) = ( dup_shift ( f , ( - K . unit ) , K ) , ( s + 1 ) ) return ( s , f , r )
square-free norm of f in k[x] .