本文整理汇总了Python中sympy.core.add.Add.equals方法的典型用法代码示例。如果您正苦于以下问题:Python Add.equals方法的具体用法?Python Add.equals怎么用?Python Add.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.core.add.Add
的用法示例。
在下文中一共展示了Add.equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calc_part
# 需要导入模块: from sympy.core.add import Add [as 别名]
# 或者: from sympy.core.add.Add import equals [as 别名]
def calc_part(expr, nexpr):
from sympy.core.add import Add
nint = int(to_int(nexpr, rnd))
n, c, p, b = nexpr
is_int = (p == 0)
if not is_int:
# if there are subs and they all contain integer re/im parts
# then we can (hopefully) safely substitute them into the
# expression
s = options.get('subs', False)
if s:
doit = True
from sympy.core.compatibility import as_int
for v in s.values():
try:
as_int(v)
except ValueError:
try:
[as_int(i) for i in v.as_real_imag()]
continue
except (ValueError, AttributeError):
doit = False
break
if doit:
expr = expr.subs(s)
expr = Add(expr, -nint, evaluate=False)
x, _, x_acc, _ = evalf(expr, 10, options)
try:
check_target(expr, (x, None, x_acc, None), 3)
except PrecisionExhausted:
if not expr.equals(0):
raise PrecisionExhausted
x = fzero
nint += int(no*(mpf_cmp(x or fzero, fzero) == no))
nint = from_int(nint)
return nint, fastlog(nint) + 10