def _dmp_simplify_gcd(f, g, u, K):
 df = dmp_degree(f, u)
 dg = dmp_degree(g, u)
 if ((df > 0) and (dg > 0)):
  return None
 if (not (df or dg)):
  F = dmp_LC(f, K)
  G = dmp_LC(g, K)
 elif (not df):
  F = dmp_LC(f, K)
  G = dmp_content(g, u, K)
 else:
  F = dmp_content(f, u, K)
  G = dmp_LC(g, K)
 v = (u - 1)
 h = dmp_gcd(F, G, v, K)
 cff = [dmp_quo(cf, h, v, K) for cf in f]
 cfg = [dmp_quo(cg, h, v, K) for cg in g]
 return ([h], cff, cfg)

def _dmp_simplify_gcd ( f , g , u , K ) : df = dmp_degree ( f , u ) dg = dmp_degree ( g , u ) if ( ( df > 0 ) and ( dg > 0 ) ) : return None if ( not ( df or dg ) ) : F = dmp_LC ( f , K ) G = dmp_LC ( g , K ) elif ( not df ) : F = dmp_LC ( f , K ) G = dmp_content ( g , u , K ) else : F = dmp_content ( f , u , K ) G = dmp_LC ( g , K ) v = ( u - 1 ) h = dmp_gcd ( F , G , v , K ) cff = [ dmp_quo ( cf , h , v , K ) for cf in f ] cfg = [ dmp_quo ( cg , h , v , K ) for cg in g ] return ( [ h ] , cff , cfg )
try to eliminate x_0 from gcd computation in k[x] .