

@timeit
def meijerint_definite(f, x, a, b):
    '\n    Integrate ``f`` over the interval [``a``, ``b``], by rewriting it as a product\n    of two G functions, or as a single G function.\n\n    Return res, cond, where cond are convergence conditions.\n\n    Examples\n    ========\n\n    >>> from sympy.integrals.meijerint import meijerint_definite\n    >>> from sympy import exp, oo\n    >>> from sympy.abc import x\n    >>> meijerint_definite(exp(-x**2), x, -oo, oo)\n    (sqrt(pi), True)\n\n    This function is implemented as a succession of functions\n    meijerint_definite, _meijerint_definite_2, _meijerint_definite_3,\n    _meijerint_definite_4. Each function in the list calls the next one\n    (presumably) several times. This means that calling meijerint_definite\n    can be very costly.\n    '
    from sympy import arg, exp, I, And, DiracDelta
    _debug('Integrating', f, ('wrt %s from %s to %s.' % (x, a, b)))
    if f.has(DiracDelta):
        _debug('Integrand has DiracDelta terms - giving up.')
        return None
    (f_, x_, a_, b_) = (f, x, a, b)
    d = Dummy('x')
    f = f.subs(x, d)
    x = d
    if (a == b):
        return (S.Zero, True)
    results = []
    if ((a == (- oo)) and (b != oo)):
        return meijerint_definite(f.subs(x, (- x)), x, (- b), (- a))
    elif (a == (- oo)):
        _debug('  Integrating -oo to +oo.')
        innermost = _find_splitting_points(f, x)
        _debug('  Sensible splitting points:', innermost)
        for c in (sorted(innermost, key=default_sort_key, reverse=True) + [S(0)]):
            _debug('  Trying to split at', c)
            if (not c.is_real):
                _debug('  Non-real splitting point.')
                continue
            res1 = _meijerint_definite_2(f.subs(x, (x + c)), x)
            if (res1 is None):
                _debug('  But could not compute first integral.')
                continue
            res2 = _meijerint_definite_2(f.subs(x, (c - x)), x)
            if (res2 is None):
                _debug('  But could not compute second integral.')
                continue
            (res1, cond1) = res1
            (res2, cond2) = res2
            cond = _condsimp(And(cond1, cond2))
            if (cond == False):
                _debug('  But combined condition is always false.')
                continue
            res = (res1 + res2)
            return (res, cond)
    elif (a == oo):
        return (- meijerint_definite(f, x, b, oo))
    elif ((a, b) == (0, oo)):
        res = _meijerint_definite_2(f, x)
        if res:
            if _has(res[0], meijerg):
                results.append(res)
            else:
                return res
    else:
        if (b == oo):
            for split in _find_splitting_points(f, x):
                if (((a - split) >= 0) == True):
                    _debug(('Trying x -> x + %s' % split))
                    res = _meijerint_definite_2((f.subs(x, (x + split)) * Heaviside(((x + split) - a))), x)
                    if res:
                        if _has(res[0], meijerg):
                            results.append(res)
                        else:
                            return res
        f = f.subs(x, (x + a))
        b = (b - a)
        a = 0
        if (b != oo):
            phi = exp((I * arg(b)))
            b = abs(b)
            f = f.subs(x, (phi * x))
            f *= (Heaviside((b - x)) * phi)
            b = oo
        _debug('Changed limits to', a, b)
        _debug('Changed function to', f)
        res = _meijerint_definite_2(f, x)
        if res:
            if _has(res[0], meijerg):
                results.append(res)
            else:
                return res
    if f_.has(HyperbolicFunction):
        _debug('Try rewriting hyperbolics in terms of exp.')
        rv = meijerint_definite(_rewrite_hyperbolics_as_exp(f_), x_, a_, b_)
        if rv:
            if (not (type(rv) is list)):
                rv = ((collect(factor_terms(rv[0]), rv[0].atoms(exp)),) + rv[1:])
                return a_
            results.extend(rv)
    if results:
        return next(ordered(results))

dataset/ETHPy150Open sympy/sympy/sympy/integrals/meijerint.py meijerint_definite/VarMisuse@858/1484 `rv`->`a_`