def prde_linear_constraints(a, b, G, DE):
 m = len(G)
 (Gns, Gds) = list(zip(*G))
 d = reduce((lambda i, j: i.lcm(j)), Gds)
 d = Poly(d, field=True)
 Q = [(ga * d.quo(gd)).div(d) for (ga, gd) in G]
 if (not all([ri.is_zero for (_, ri) in Q])):
  N = max([ri.degree(DE.t) for (_, ri) in Q])
  M = Matrix((N + 1), m, (lambda i, j: Q[j][1].nth(i)))
 else:
  M = Matrix()
 (qs, _) = list(zip(*Q))
 return (qs, M)

def prde_linear_constraints ( a , b , G , DE ) : m = len ( G ) ( Gns , Gds ) = list ( zip ( * G ) ) d = reduce ( ( lambda i , j : i . lcm ( j ) ) , Gds ) d = Poly ( d , field = True ) Q = [ ( ga * d . quo ( gd ) ) . div ( d ) for ( ga , gd ) in G ] if ( not all ( [ ri . is_zero for ( _ , ri ) in Q ] ) ) : N = max ( [ ri . degree ( DE . t ) for ( _ , ri ) in Q ] ) M = Matrix ( ( N + 1 ) , m , ( lambda i , j : Q [ j ] [ 1 ] . nth ( i ) ) ) else : M = Matrix ( ) ( qs , _ ) = list ( zip ( * Q ) ) return ( qs , M )
parametric risch differential equation - generate linear constraints on the constants .