#NEWLINE# def special_denom( a , ba , bd , ca , cd , DE , case = 'auto' ) : #NEWLINE# #INDENT# "\n    Special part of the denominator.\n\n    case is one of {'exp', 'tan', 'primitive'} for the hyperexponential,\n    hypertangent, and primitive cases, respectively.  For the\n    hyperexponential (resp. hypertangent) case, given a derivation D on\n    k[t] and a in k[t], b, c, in k<t> with Dt/t in k (resp. Dt/(t**2 + 1) in\n    k, sqrt(-1) not in k), a != 0, and gcd(a, t) == 1 (resp.\n    gcd(a, t**2 + 1) == 1), return the quadruplet (A, B, C, 1/h) such that\n    A, B, C, h in k[t] and for any solution q in k<t> of a*Dq + b*q == c,\n    r = qh in k[t] satisfies A*Dr + B*r == C.\n\n    For case == 'primitive', k<t> == k[t], so it returns (a, b, c, 1) in\n    this case.\n\n    This constitutes step 2 of the outline given in the rde.py docstring.\n    " #NEWLINE# from sympy.integrals.prde import parametric_log_deriv #NEWLINE# if ( case == 'auto' ) : #NEWLINE# #INDENT# case = DE . case #NEWLINE# #UNINDENT# if ( case == 'exp' ) : #NEWLINE# #INDENT# p = Poly ( DE . t , DE . t ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( case == 'tan' ) : #NEWLINE# #INDENT# p = Poly ( ( ( DE . t ** 2 ) + 1 ) , DE . t ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( case in [ 'primitive' , 'base' ] ) : #NEWLINE# #INDENT# B = ba . to_field ( ) . quo ( bd ) #NEWLINE# C = ca . to_field ( ) . quo ( cd ) #NEWLINE# return ( a , B , C , Poly ( 1 , DE . t ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( "case must be one of {'exp', 'tan', 'primitive', 'base'}, not %s." % case ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# nb = ( order_at ( ba , p , DE . t ) - order_at ( bd , p , DE . t ) ) #NEWLINE# nc = ( order_at ( ca , p , DE . t ) - order_at ( cd , p , DE . t ) ) #NEWLINE# n = min ( 0 , ( nc - min ( 0 , nb ) ) ) #NEWLINE# if ( not nb ) : #NEWLINE# #INDENT# if ( case == 'exp' ) : #NEWLINE# #INDENT# dcoeff = DE . d . quo ( Poly ( DE . t , DE . t ) ) #NEWLINE# with DecrementLevel ( DE ) : #NEWLINE# #INDENT# ( alphaa , alphad ) = frac_in ( ( ( ( - ba . eval ( 0 ) ) / bd . eval ( 0 ) ) / a . eval ( 0 ) ) , DE . t ) #NEWLINE# ( etaa , etad ) = frac_in ( dcoeff , DE . t ) #NEWLINE# A = parametric_log_deriv ( alphaa , alphad , etaa , etad , DE ) #NEWLINE# if ( A is not None ) : #NEWLINE# #INDENT# ( a , m , z ) = A #NEWLINE# if ( a == 1 ) : #NEWLINE# #INDENT# n = min ( n , m ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( case == 'tan' ) : #NEWLINE# #INDENT# dcoeff = DE . d . quo ( Poly ( ( ( DE . t ** 2 ) + 1 ) , DE . t ) ) #NEWLINE# with DecrementLevel ( DE ) : #NEWLINE# #INDENT# ( alphaa , alphad ) = frac_in ( im ( ( ( ( - ba . eval ( sqrt ( ( - 1 ) ) ) ) / bd . eval ( sqrt ( ( - 1 ) ) ) ) / a . eval ( sqrt ( ( - 1 ) ) ) ) ) , DE . t ) #NEWLINE# ( betaa , betad ) = frac_in ( re ( ( ( ( - ba . eval ( sqrt ( ( - 1 ) ) ) ) / bd . eval ( sqrt ( ( - 1 ) ) ) ) / a . eval ( sqrt ( ( - 1 ) ) ) ) ) , DE . t ) #NEWLINE# ( etaa , etad ) = frac_in ( dcoeff , DE . t ) #NEWLINE# if recognize_log_derivative ( ( 2 * betaa ) , betad , DE ) : #NEWLINE# #INDENT# A = parametric_log_deriv ( ( ( ( alphaa * sqrt ( ( - 1 ) ) ) * betad ) + ( alphad * betaa ) ) , ( alphad * betad ) , etaa , etad , DE ) #NEWLINE# if ( A is not None ) : #NEWLINE# #INDENT# ( a , m , z ) = A #NEWLINE# if ( a == 1 ) : #NEWLINE# #INDENT# n = min ( n , m ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# N = max ( 0 , ( - nb ) , ( n - nc ) ) #NEWLINE# pN = ( p ** N ) #NEWLINE# pn = ( p ** ( - n ) ) #NEWLINE# A = ( a * pN ) #NEWLINE# B = ( ( ba * pN . quo ( bd ) ) + ( ( ( Poly ( n , DE . t ) * a ) * derivation ( p , DE ) . quo ( p ) ) * pN ) ) #NEWLINE# C = ( ( ca * pN ) * pn ) . quo ( cd ) #NEWLINE# h = pn #NEWLINE# return ( A , B , C , h )