本文整理汇总了Python中sympy.core.basic.C.abs方法的典型用法代码示例。如果您正苦于以下问题:Python C.abs方法的具体用法?Python C.abs怎么用?Python C.abs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.core.basic.C
的用法示例。
在下文中一共展示了C.abs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _eval_expand_complex
# 需要导入模块: from sympy.core.basic import C [as 别名]
# 或者: from sympy.core.basic.C import abs [as 别名]
def _eval_expand_complex(self, deep=True, **hints):
if deep:
abs = C.abs(self.args[0].expand(deep, **hints))
arg = C.arg(self.args[0].expand(deep, **hints))
else:
abs = C.abs(self.args[0])
arg = C.arg(self.args[0])
if hints['log']: # Expand the log
hints['complex'] = False
return log(abs).expand(deep, **hints) + S.ImaginaryUnit * arg
else:
return log(abs) + S.ImaginaryUnit * arg
示例2: canonize
# 需要导入模块: from sympy.core.basic import C [as 别名]
# 或者: from sympy.core.basic.C import abs [as 别名]
def canonize(cls, y, x):
sign_y = C.sign(y)
if y.is_zero:
if x.is_positive:
return S.Zero
elif x.is_zero:
return S.NaN
elif x.is_negative:
return S.Pi
elif x.is_zero:
if sign_y.is_Number:
return sign_y * S.Pi/2
else:
abs_yx = C.abs(y/x)
if sign_y.is_Number and abs_yx.is_number:
phi = C.atan(abs_yx)
if x.is_positive:
return sign_y * phi
else:
return sign_y * (S.Pi - phi)
示例3: _eval_expand_complex
# 需要导入模块: from sympy.core.basic import C [as 别名]
# 或者: from sympy.core.basic.C import abs [as 别名]
def _eval_expand_complex(self, *args):
abs = C.abs(self.args[0])
arg = C.arg(self.args[0])
return log(abs) + S.ImaginaryUnit * arg