

def hypersimp(f, k):
    'Given combinatorial term f(k) simplify its consecutive term ratio\n       i.e. f(k+1)/f(k).  The input term can be composed of functions and\n       integer sequences which have equivalent representation in terms\n       of gamma special function.\n\n       The algorithm performs three basic steps:\n\n       1. Rewrite all functions in terms of gamma, if possible.\n\n       2. Rewrite all occurrences of gamma in terms of products\n          of gamma and rising factorial with integer,  absolute\n          constant exponent.\n\n       3. Perform simplification of nested fractions, powers\n          and if the resulting expression is a quotient of\n          polynomials, reduce their total degree.\n\n       If f(k) is hypergeometric then as result we arrive with a\n       quotient of polynomials of minimal degree. Otherwise None\n       is returned.\n\n       For more information on the implemented algorithm refer to:\n\n       1. W. Koepf, Algorithms for m-fold Hypergeometric Summation,\n          Journal of Symbolic Computation (1995) 20, 399-417\n    '
    f = sympify(f)
    g = (f.subs(f, (k + 1)) / f)
    g = g.rewrite(gamma)
    g = expand_func(g)
    g = powsimp(g, deep=True, combine='exp')
    if g.is_rational_function(k):
        return simplify(g, ratio=S.Infinity)
    else:
        return None

dataset/ETHPy150Open sympy/sympy/sympy/simplify/simplify.py hypersimp/VarMisuse@28/420 `k`->`f`