

def _split_mul(f, x):
    '\n    Split expression ``f`` into fac, po, g, where fac is a constant factor,\n    po = x**s for some s independent of s, and g is "the rest".\n\n    >>> from sympy.integrals.meijerint import _split_mul\n    >>> from sympy import sin\n    >>> from sympy.abc import s, x\n    >>> _split_mul((3*x)**s*sin(x**2)*x, x)\n    (3**s, x*x**s, sin(x**2))\n    '
    from sympy import polarify, unpolarify
    fac = S(1)
    po = S(1)
    g = S(1)
    f = expand_power_base(f)
    args = Mul.make_args(f)
    for a in args:
        if (a == x):
            po *= x
        elif (x not in a.free_symbols):
            fac *= a
        else:
            if (a.is_Pow and (x not in a.exp.free_symbols)):
                (c, t) = a.base.as_coeff_mul(x)
                if (t != (x,)):
                    (c, t) = expand_mul(a.base).as_coeff_mul(x)
                if (t == (x,)):
                    po *= (x ** a.exp)
                    fac *= unpolarify(polarify((c ** a.exp), subs=False))
                    continue
            g *= a
    return (fac, po, g)

dataset/ETHPy150Open sympy/sympy/sympy/integrals/meijerint.py _split_mul/original