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
我这么想吗?
预先感谢。