def dmp_prs_resultant(f, g, u, K):
    if not u:
        return dup_prs_resultant(f, g, K)

    if dmp_zero_p(f, u) or dmp_zero_p(g, u):
        return (dmp_zero(u - 1), [])

    R, S = dmp_inner_subresultants(f, g, u, K)

    if dmp_degree(R[-1], u) > 0:
        return (dmp_zero(u - 1), R)

    return S[-1], R
Resultant algorithm in `K[X]` using subresultant PRS.
dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py/dmp_prs_resultant