2
sympy(版本1.1.1)文件collect_const
說,使用Numbers=False
選項,「不收集浮動或理性」。這使得你認爲有理數通常由collect_const
收集,但他們似乎並不爲:sympy收集合理collect_const
>>> from sympy import *
>>> x, y, z = symbols('x y z')
>>> collect_const(2*x - 2*y - 2*z, 2)
2*(x - y - z)
>>> collect_const(x/2 - y/2 - z/2, 1/2)
x/2 - y/2 - z/2
我這麼想嗎?
預先感謝。