

def _eval_imageset(self, f):
    expr = f.expr
    if (not isinstance(expr, Expr)):
        return
    if (len(f.variables) > 1):
        return
    n = f.variables[0]
    c = f(0)
    fx = (f(n) - c)
    f_x = (f((- n)) - c)
    neg_count = (lambda e: sum((_coeff_isneg(_) for _ in Add.make_args(e))))
    if (neg_count(f_x) < neg_count(fx)):
        expr = (f_x + c)
    a = Wild('a', exclude=[n])
    b = Wild('b', exclude=[n])
    match = expr.match(((match * n) + b))
    if (match and match[a]):
        expr = ((match[a] * n) + (match[b] % match[a]))
    if (expr != f.expr):
        return ImageSet(Lambda(n, expr), S.Integers)

dataset/ETHPy150Open sympy/sympy/sympy/sets/fancysets.py Integers._eval_imageset/VarMisuse@176/206 `a`->`match`