def dmp_qq_collins_resultant(f, g, u, K0):
 n = dmp_degree(f, u)
 m = dmp_degree(g, u)
 if ((n < 0) or (m < 0)):
  return dmp_zero((u - 1))
 K1 = K0.get_ring()
 (cf, f) = dmp_clear_denoms(f, u, K0, K1)
 (cg, g) = dmp_clear_denoms(g, u, K0, K1)
 f = dmp_convert(f, u, K0, K1)
 g = dmp_convert(g, u, K0, K1)
 r = dmp_zz_collins_resultant(f, g, u, K1)
 r = dmp_convert(r, (u - 1), K1, K0)
 c = K0.convert(((cf ** m) * (cg ** n)), K1)
 return dmp_quo_ground(r, c, (u - 1), K0)

def dmp_qq_collins_resultant ( f , g , u , K0 ) : n = dmp_degree ( f , u ) m = dmp_degree ( g , u ) if ( ( n < 0 ) or ( m < 0 ) ) : return dmp_zero ( ( u - 1 ) ) K1 = K0 . get_ring ( ) ( cf , f ) = dmp_clear_denoms ( f , u , K0 , K1 ) ( cg , g ) = dmp_clear_denoms ( g , u , K0 , K1 ) f = dmp_convert ( f , u , K0 , K1 ) g = dmp_convert ( g , u , K0 , K1 ) r = dmp_zz_collins_resultant ( f , g , u , K1 ) r = dmp_convert ( r , ( u - 1 ) , K1 , K0 ) c = K0 . convert ( ( ( cf ** m ) * ( cg ** n ) ) , K1 ) return dmp_quo_ground ( r , c , ( u - 1 ) , K0 )
collinss modular resultant algorithm in q[x] .