def decompose_power(expr):
 (base, exp) = expr.as_base_exp()
 if exp.is_Number:
  if exp.is_Rational:
   if (not exp.is_Integer):
    base = Pow(base, Rational(1, exp.q))
   exp = exp.p
  else:
   (base, exp) = (expr, 1)
 else:
  (exp, tail) = exp.as_coeff_Mul(rational=True)
  if (exp is S.NegativeOne):
   (base, exp) = (Pow(base, tail), (-1))
  elif (exp is not S.One):
   tail = _keep_coeff(Rational(1, exp.q), tail)
   (base, exp) = (Pow(base, tail), exp.p)
  else:
   (base, exp) = (expr, 1)
 return (base, exp)

def decompose_power ( expr ) : ( base , exp ) = expr . as_base_exp ( ) if exp . is_Number : if exp . is_Rational : if ( not exp . is_Integer ) : base = Pow ( base , Rational ( 1 , exp . q ) ) exp = exp . p else : ( base , exp ) = ( expr , 1 ) else : ( exp , tail ) = exp . as_coeff_Mul ( rational = True ) if ( exp is S . NegativeOne ) : ( base , exp ) = ( Pow ( base , tail ) , ( - 1 ) ) elif ( exp is not S . One ) : tail = _keep_coeff ( Rational ( 1 , exp . q ) , tail ) ( base , exp ) = ( Pow ( base , tail ) , exp . p ) else : ( base , exp ) = ( expr , 1 ) return ( base , exp )
decompose power into symbolic base and integer exponent .