def _eval_power(self, other):
from sympy.functions.elementary.exponential import log
b, e = self.as_base_exp()
b_nneg = b.is_nonnegative
if b.is_real and not b_nneg and e.is_even:
b = abs(b)
b_nneg = True
# Special case for when b is nan. See pull req 1714 for details
if b is S.NaN:
smallarg = abs(e).is_negative
else:
smallarg = (abs(e) - abs(S.Pi/log(b))).is_negative
if (other.is_Rational and other.q == 2 and
e.is_real is False and smallarg is False):
return -self.func(b, e*other)
if (other.is_integer or
e.is_real and (b_nneg or (abs(e) < 1) == True) or
e.is_real is False and smallarg is True or
b.is_polar):
return self.func(b, e*other)
评论列表
文章目录