(F, s, x_, strip, as_meijerg=False)
A helper for the real inverse_mellin_transform function, this one here
        assumes x to be real and positive.
A helper for the real inverse_mellin_transform function, this one here
        assumes x to be real and positive.
A helper for the real inverse_mellin_transform function this one here assumes x to be real and positive .
def _inverse_mellin_transform(F, s, x_, strip, as_meijerg=False):
    """ A helper for the real inverse_mellin_transform function, this one here
        assumes x to be real and positive. """
    from sympy import (expand, expand_mul, hyperexpand, meijerg, And, Or,
                       arg, pi, re, factor, Heaviside, gamma, Add)
    x = _dummy('t', 'inverse-mellin-transform', F, positive=True)
    # Actually, we won't try integration at all. Instead we use the definition
    # of the Meijer G function as a fairly general inverse mellin transform.
    F = F.rewrite(gamma)
    for g in [factor(F), expand_mul(F), expand(F)]:
        if g.is_Add:
            # do all terms separately
            ress = [_inverse_mellin_transform(G, s, x, strip, as_meijerg,
                                              noconds=False)
                    for G in g.args]
            conds = [p[1] for p in ress]
            ress = [p[0] for p in ress]
            res = Add(*ress)
            if not as_meijerg:
                res = factor(res, gens=res.atoms(Heaviside))
            return res.subs(x, x_), And(*conds)

        try:
            a, b, C, e, fac = _rewrite_gamma(g, s, strip[0], strip[1])
        except IntegralTransformError:
            continue
        G = meijerg(a, b, C/x**e)
        if as_meijerg:
            h = G
        else:
            try:
                h = hyperexpand(G)
            except NotImplementedError as detail:
                raise IntegralTransformError(
                    'Inverse Mellin', F, 'Could not calculate integral')

            if h.is_Piecewise and len(h.args) == 3:
                # XXX we break modularity here!
                h = Heaviside(x - abs(C))*h.args[0].args[0] \
                    + Heaviside(abs(C) - x)*h.args[1].args[0]
        # We must ensure that the intgral along the line we want converges,
        # and return that value.
        # See [L], 5.2
        cond = [abs(arg(G.argument)) < G.delta*pi]
        # Note: we allow ">=" here, this corresponds to convergence if we let
        # limits go to oo symetrically. ">" corresponds to absolute convergence.
        cond += [And(Or(len(G.ap) != len(G.bq), 0 >= re(G.nu) + 1),
                     abs(arg(G.argument)) == G.delta*pi)]
        cond = Or(*cond)
        if cond == False:
            raise IntegralTransformError(
                'Inverse Mellin', F, 'does not converge')
        return (h*fac).subs(x, x_), cond

    raise IntegralTransformError('Inverse Mellin', F, '')
def _inverse_mellin_transform ( F , s , x_ , strip , as_meijerg = False ) : from sympy import ( expand , expand_mul , hyperexpand , meijerg , And , Or , arg , pi , re , factor , Heaviside , gamma , Add ) x = _dummy ( 't' , 'inverse-mellin-transform' , F , positive = True ) # Actually, we won't try integration at all. Instead we use the definition # of the Meijer G function as a fairly general inverse mellin transform. F = F . rewrite ( gamma ) for g in [ factor ( F ) , expand_mul ( F ) , expand ( F ) ] : if g . is_Add : # do all terms separately ress = [ _inverse_mellin_transform ( G , s , x , strip , as_meijerg , noconds = False ) for G in g . args ] conds = [ p [ 1 ] for p in ress ] ress = [ p [ 0 ] for p in ress ] res = Add ( * ress ) if not as_meijerg : res = factor ( res , gens = res . atoms ( Heaviside ) ) return res . subs ( x , x_ ) , And ( * conds ) try : a , b , C , e , fac = _rewrite_gamma ( g , s , strip [ 0 ] , strip [ 1 ] ) except IntegralTransformError : continue G = meijerg ( a , b , C / x ** e ) if as_meijerg : h = G else : try : h = hyperexpand ( G ) except NotImplementedError as detail : raise IntegralTransformError ( 'Inverse Mellin' , F , 'Could not calculate integral' ) if h . is_Piecewise and len ( h . args ) == 3 : # XXX we break modularity here! h = Heaviside ( x - abs ( C ) ) * h . args [ 0 ] . args [ 0 ] + Heaviside ( abs ( C ) - x ) * h . args [ 1 ] . args [ 0 ] # We must ensure that the intgral along the line we want converges, # and return that value. # See [L], 5.2 cond = [ abs ( arg ( G . argument ) ) < G . delta * pi ] # Note: we allow ">=" here, this corresponds to convergence if we let # limits go to oo symetrically. ">" corresponds to absolute convergence. cond += [ And ( Or ( len ( G . ap ) != len ( G . bq ) , 0 >= re ( G . nu ) + 1 ) , abs ( arg ( G . argument ) ) == G . delta * pi ) ] cond = Or ( * cond ) if cond == False : raise IntegralTransformError ( 'Inverse Mellin' , F , 'does not converge' ) return ( h * fac ) . subs ( x , x_ ) , cond raise IntegralTransformError ( 'Inverse Mellin' , F , '' )