

def dmp_qq_collins_resultant(f, g, u, K0):
    '\n    Collins\'s modular resultant algorithm in `Q[X]`.\n\n    Examples\n    ========\n\n    >>> from sympy.polys import ring, QQ\n    >>> R, x,y = ring("x,y", QQ)\n\n    >>> f = QQ(1,2)*x + y + QQ(2,3)\n    >>> g = 2*x*y + x + 3\n\n    >>> R.dmp_qq_collins_resultant(f, g)\n    -2*y**2 - 7/3*y + 5/6\n\n    '
    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)

dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py dmp_qq_collins_resultant/original