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

    Computes the subresultant polynomial remainder sequence (PRS) of `f`
    and `g`, and the values for `\beta_i` and `\delta_i`. The last two
    sequences of values are necessary for computing the resultant in
    :func:`dup_prs_resultant`.

    Examples
    ========

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

    >>> R.dup_inner_subresultants(x**2 + 1, x**2 - 1)
    ([x**2 + 1, x**2 - 1, -2], [-1, -1], [0, 2])
Subresultant PRS algorithm in `K[x]`.
Subresultant PRS algorithm in K [ x ] .
def dup_inner_subresultants(f, g, K):
    """
    Subresultant PRS algorithm in `K[x]`.

    Computes the subresultant polynomial remainder sequence (PRS) of `f`
    and `g`, and the values for `\beta_i` and `\delta_i`. The last two
    sequences of values are necessary for computing the resultant in
    :func:`dup_prs_resultant`.

    Examples
    ========

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

    >>> R.dup_inner_subresultants(x**2 + 1, x**2 - 1)
    ([x**2 + 1, x**2 - 1, -2], [-1, -1], [0, 2])

    """
    n = dup_degree(f)
    m = dup_degree(g)

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

    R = [f, g]
    d = n - m

    b = (-K.one)**(d + 1)
    c = -K.one

    B, D = [b], [d]

    if not f or not g:
        return R, B, D

    h = dup_prem(f, g, K)
    h = dup_mul_ground(h, b, K)

    while h:
        k = dup_degree(h)
        R.append(h)

        lc = dup_LC(g, K)

        if not d:
            q = c
        else:
            q = c**(d - 1)

        c = K.quo((-lc)**d, q)
        b = -lc * c**(m - k)

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

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

        h = dup_prem(f, g, K)

        h = dup_quo_ground(h, b, K)

    return R, B, D
def dup_inner_subresultants ( f , g , K ) : n = dup_degree ( f ) m = dup_degree ( g ) if n < m : f , g = g , f n , m = m , n R = [ f , g ] d = n - m b = ( - K . one ) ** ( d + 1 ) c = - K . one B , D = [ b ] , [ d ] if not f or not g : return R , B , D h = dup_prem ( f , g , K ) h = dup_mul_ground ( h , b , K ) while h : k = dup_degree ( h ) R . append ( h ) lc = dup_LC ( g , K ) if not d : q = c else : q = c ** ( d - 1 ) c = K . quo ( ( - lc ) ** d , q ) b = - lc * c ** ( m - k ) f , g , m , d = g , h , k , m - k B . append ( b ) D . append ( d ) h = dup_prem ( f , g , K ) h = dup_quo_ground ( h , b , K ) return R , B , D