def isReversible(self, formula):
formula = expand(formula)
# If we had an addition
if formula.func == SympyAdd:
# And one of the terms
for arg in formula.args:
# is *(-1)
if (arg.func == SympyMul
and (arg.args[0] == SympyInteger(-1)
or arg.args[1] == SympyInteger(-1))):
return True
return False
评论列表
文章目录