(f, g, u, K)
return R, B, D
Subresultant PRS algorithm in `K[X]`.

    Examples
    ========

    >>> from sympy.polys import ring, ZZ
    >>> R, x,y = ring("x,y", ZZ)

    >>> f = 3*x**2*y - y**3 - 4
    >>> g = x**2 + x*y**3 - 9

    >>> a = 3*x*y**4 + y**3 - 27*y + 4
    >>> b = -3*y**10 - 12*y**7 + y**6 - 54*y**4 + 8*y**3 + 729*y**2 - 216*y + 16

    >>> prs = [f, g, a, b]
    >>> beta = [[-1], [1], [9, 0, 0, 0, 0, 0, 0, 0, 0]]
    >>> delta = [0, 1, 1]

    >>> R.dmp_inner_subresultants(f, g) == (prs, beta, delta)
    True
Subresultant PRS algorithm in `K[X]`.
Subresultant PRS algorithm in K [ X ] .
def dmp_inner_subresultants(f, g, u, K):
    """
    Subresultant PRS algorithm in `K[X]`.

    Examples
    ========

    >>> from sympy.polys import ring, ZZ
    >>> R, x,y = ring("x,y", ZZ)

    >>> f = 3*x**2*y - y**3 - 4
    >>> g = x**2 + x*y**3 - 9

    >>> a = 3*x*y**4 + y**3 - 27*y + 4
    >>> b = -3*y**10 - 12*y**7 + y**6 - 54*y**4 + 8*y**3 + 729*y**2 - 216*y + 16

    >>> prs = [f, g, a, b]
    >>> beta = [[-1], [1], [9, 0, 0, 0, 0, 0, 0, 0, 0]]
    >>> delta = [0, 1, 1]

    >>> R.dmp_inner_subresultants(f, g) == (prs, beta, delta)
    True

    """
    if not u:
        return dup_inner_subresultants(f, g, K)

    n = dmp_degree(f, u)
    m = dmp_degree(g, u)

    if n < m:
        f, g = g, f
        n, m = m, n

    R = [f, g]
    d = n - m
    v = u - 1

    b = dmp_pow(dmp_ground(-K.one, v), d + 1, v, K)
    c = dmp_ground(-K.one, v)

    B, D = [b], [d]

    if dmp_zero_p(f, u) or dmp_zero_p(g, u):
        return R, B, D

    h = dmp_prem(f, g, u, K)
    h = dmp_mul_term(h, b, 0, u, K)

    while not dmp_zero_p(h, u):
        k = dmp_degree(h, u)
        R.append(h)

        lc = dmp_LC(g, K)

        p = dmp_pow(dmp_neg(lc, v, K), d, v, K)

        if not d:
            q = c
        else:
            q = dmp_pow(c, d - 1, v, K)

        c = dmp_quo(p, q, v, K)
        b = dmp_mul(dmp_neg(lc, v, K),
                    dmp_pow(c, m - k, v, K), v, K)

        f, g, m, d = g, h, k, m - k

        B.append(b)
        D.append(d)

        h = dmp_prem(f, g, u, K)

        h = [ dmp_quo(ch, b, v, K) for ch in h ]

    return R, B, D
def dmp_inner_subresultants ( f , g , u , K ) : if not u : return dup_inner_subresultants ( f , g , K ) n = dmp_degree ( f , u ) m = dmp_degree ( g , u ) if n < m : f , g = g , f n , m = m , n R = [ f , g ] d = n - m v = u - 1 b = dmp_pow ( dmp_ground ( - K . one , v ) , d + 1 , v , K ) c = dmp_ground ( - K . one , v ) B , D = [ b ] , [ d ] if dmp_zero_p ( f , u ) or dmp_zero_p ( g , u ) : return R , B , D h = dmp_prem ( f , g , u , K ) h = dmp_mul_term ( h , b , 0 , u , K ) while not dmp_zero_p ( h , u ) : k = dmp_degree ( h , u ) R . append ( h ) lc = dmp_LC ( g , K ) p = dmp_pow ( dmp_neg ( lc , v , K ) , d , v , K ) if not d : q = c else : q = dmp_pow ( c , d - 1 , v , K ) c = dmp_quo ( p , q , v , K ) b = dmp_mul ( dmp_neg ( lc , v , K ) , dmp_pow ( c , m - k , v , K ) , v , K ) f , g , m , d = g , h , k , m - k B . append ( b ) D . append ( d ) h = dmp_prem ( f , g , u , K ) h = [ dmp_quo ( ch , b , v , K ) for ch in h ] return R , B , D