(b, c, n, DE)
return q
Poly Risch Differential Equation - No cancellation: deg(b) large enough.

    Given a derivation D on k[t], n either an integer or +oo, and b, c
    in k[t] with b != 0 and either D == d/dt or
    deg(b) > max(0, deg(D) - 1), either raise NonElementaryIntegralException, in
    which case the equation Dq + b*q == c has no solution of degree at
    most n in k[t], or a solution q in k[t] of this equation with
    deg(q) < n.
Poly Risch Differential Equation - No cancellation: deg(b) large enough.
Poly Risch Differential Equation - No cancellation : deg ( b ) large enough .
def no_cancel_b_large(b, c, n, DE):
    """
    Poly Risch Differential Equation - No cancellation: deg(b) large enough.

    Given a derivation D on k[t], n either an integer or +oo, and b, c
    in k[t] with b != 0 and either D == d/dt or
    deg(b) > max(0, deg(D) - 1), either raise NonElementaryIntegralException, in
    which case the equation Dq + b*q == c has no solution of degree at
    most n in k[t], or a solution q in k[t] of this equation with
    deg(q) < n.
    """
    q = Poly(0, DE.t)

    while not c.is_zero:
        m = c.degree(DE.t) - b.degree(DE.t)
        if not 0 <= m <= n:  # n < 0 or m < 0 or m > n
            raise NonElementaryIntegralException

        p = Poly(c.as_poly(DE.t).LC()/b.as_poly(DE.t).LC()*DE.t**m, DE.t,
            expand=False)
        q = q + p
        n = m - 1
        c = c - derivation(p, DE) - b*p

    return q
def no_cancel_b_large ( b , c , n , DE ) : q = Poly ( 0 , DE . t ) while not c . is_zero : m = c . degree ( DE . t ) - b . degree ( DE . t ) if not 0 <= m <= n : # n < 0 or m < 0 or m > n raise NonElementaryIntegralException p = Poly ( c . as_poly ( DE . t ) . LC ( ) / b . as_poly ( DE . t ) . LC ( ) * DE . t ** m , DE . t , expand = False ) q = q + p n = m - 1 c = c - derivation ( p , DE ) - b * p return q