本文整理匯總了Python中sympy.core.power.Pow類的典型用法代碼示例。如果您正苦於以下問題:Python Pow類的具體用法?Python Pow怎麽用?Python Pow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Pow類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _eval_subs
def _eval_subs(self, old, new):
# keep processing of power-like args centralized in Pow
if old.is_Pow: # handle (exp(3*log(x))).subs(x**2, z) -> z**(3/2)
old = exp(old.exp * log(old.base))
elif old is S.Exp1 and new.is_Function:
old = exp
if old.func is exp or old is S.Exp1:
f = lambda a: Pow(*a.as_base_exp(), evaluate=False) if (a.is_Pow or a.func is exp) else a
return Pow._eval_subs(f(self), f(old), new)
if old is exp and not new.is_Function:
return new ** self.exp._subs(old, new)
return Function._eval_subs(self, old, new)
示例2: _eval_power
def _eval_power(self, other):
"""exp(arg)**e -> exp(arg*e) if assumptions allow it.
"""
b, e = self.as_base_exp()
return Pow._eval_power(Pow(b, e, evaluate=False), other)