

def _get_coeff_exp(expr, x):
    '\n    When expr is known to be of the form c*x**b, with c and/or b possibly 1,\n    return c, b.\n\n    >>> from sympy.abc import x, a, b\n    >>> from sympy.integrals.meijerint import _get_coeff_exp\n    >>> _get_coeff_exp(a*x**b, x)\n    (a, b)\n    >>> _get_coeff_exp(x, x)\n    (1, 1)\n    >>> _get_coeff_exp(2*x, x)\n    (2, 1)\n    >>> _get_coeff_exp(x**3, x)\n    (1, 3)\n    '
    from sympy import powsimp
    (c, m) = expand_power_base(powsimp(expr)).as_coeff_mul(x)
    if (not m):
        return (c, S(0))
    [m] = m
    if m.is_Pow:
        if (m.base != x):
            raise _CoeffExpValueError('expr not of form a*x**b')
        return (c, m.exp)
    elif (m == x):
        return (c, S(1))
    else:
        raise _CoeffExpValueError(('expr not of form a*x**b: %s' % expr))

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