(fa, fd, G, DE)
Solves the limited integration problem:  f = Dv + Sum(ci*wi, (i, 1, n))
Solves the limited integration problem:  f = Dv + Sum(ci*wi, (i, 1, n))
Solves the limited integration problem : f = Dv + Sum ( ci * wi ( i 1 n ))
def limited_integrate(fa, fd, G, DE):
    """
    Solves the limited integration problem:  f = Dv + Sum(ci*wi, (i, 1, n))
    """
    fa, fd = fa*Poly(1/fd.LC(), DE.t), fd.monic()
    A, B, h, N, g, V = limited_integrate_reduce(fa, fd, G, DE)
    V = [g] + V
    g = A.gcd(B)
    A, B, V = A.quo(g), B.quo(g), [via.cancel(vid*g, include=True) for
        via, vid in V]
    Q, M = prde_linear_constraints(A, B, V, DE)
    M, _ = constant_system(M, zeros(M.rows, 1), DE)
    l = M.nullspace()
    if M == Matrix() or len(l) > 1:
        # Continue with param_rischDE()
        raise NotImplementedError("param_rischDE() is required to solve this "
            "integral.")
    elif len(l) == 0:
        raise NonElementaryIntegralException
    elif len(l) == 1:
        # The c1 == 1.  In this case, we can assume a normal Risch DE
        if l[0][0].is_zero:
            raise NonElementaryIntegralException
        else:
            l[0] *= 1/l[0][0]
            C = sum([Poly(i, DE.t)*q for (i, q) in zip(l[0], Q)])
            # Custom version of rischDE() that uses the already computed
            # denominator and degree bound from above.
            B, C, m, alpha, beta = spde(A, B, C, N, DE)
            y = solve_poly_rde(B, C, m, DE)

            return ((alpha*y + beta, h), list(l[0][1:]))
    else:
        raise NotImplementedError
def limited_integrate ( fa , fd , G , DE ) : fa , fd = fa * Poly ( 1 / fd . LC ( ) , DE . t ) , fd . monic ( ) A , B , h , N , g , V = limited_integrate_reduce ( fa , fd , G , DE ) V = [ g ] + V g = A . gcd ( B ) A , B , V = A . quo ( g ) , B . quo ( g ) , [ via . cancel ( vid * g , include = True ) for via , vid in V ] Q , M = prde_linear_constraints ( A , B , V , DE ) M , _ = constant_system ( M , zeros ( M . rows , 1 ) , DE ) l = M . nullspace ( ) if M == Matrix ( ) or len ( l ) > 1 : # Continue with param_rischDE() raise NotImplementedError ( "param_rischDE() is required to solve this " "integral." ) elif len ( l ) == 0 : raise NonElementaryIntegralException elif len ( l ) == 1 : # The c1 == 1.  In this case, we can assume a normal Risch DE if l [ 0 ] [ 0 ] . is_zero : raise NonElementaryIntegralException else : l [ 0 ] *= 1 / l [ 0 ] [ 0 ] C = sum ( [ Poly ( i , DE . t ) * q for ( i , q ) in zip ( l [ 0 ] , Q ) ] ) # Custom version of rischDE() that uses the already computed # denominator and degree bound from above. B , C , m , alpha , beta = spde ( A , B , C , N , DE ) y = solve_poly_rde ( B , C , m , DE ) return ( ( alpha * y + beta , h ) , list ( l [ 0 ] [ 1 : ] ) ) else : raise NotImplementedError