def _transform_DE_RE(DE, g, k, order, syms):
 from sympy.solvers.solveset import linsolve
 RE = hyper_re(DE, g, k)
 eq = []
 for i in range(1, order):
  coeff = RE.coeff(g((k + i)))
  eq.append(coeff)
 sol = dict(zip(syms, (i for s in linsolve(eq, list(syms)) for i in s)))
 if sol:
  m = Wild('m')
  RE = RE.subs(sol)
  RE = RE.factor().as_numer_denom()[0].collect(g((k + m)))
  RE = RE.as_coeff_mul(g)[1][0]
  for i in range(order):
   if (RE.coeff(g((k + i))) and i):
    RE = RE.subs(k, (k - i))
    break
 return RE

def _transform_DE_RE ( DE , g , k , order , syms ) : from sympy . solvers . solveset import linsolve RE = hyper_re ( DE , g , k ) eq = [ ] for i in range ( 1 , order ) : coeff = RE . coeff ( g ( ( k + i ) ) ) eq . append ( coeff ) sol = dict ( zip ( syms , ( i for s in linsolve ( eq , list ( syms ) ) for i in s ) ) ) if sol : m = Wild ( 'm' ) RE = RE . subs ( sol ) RE = RE . factor ( ) . as_numer_denom ( ) [ 0 ] . collect ( g ( ( k + m ) ) ) RE = RE . as_coeff_mul ( g ) [ 1 ] [ 0 ] for i in range ( order ) : if ( RE . coeff ( g ( ( k + i ) ) ) and i ) : RE = RE . subs ( k , ( k - i ) ) break return RE
converts de with free parameters into re of hypergeometric type .