Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正如我在 sympy 文档中所读到的,solve() 命令期望一个方程求解为等于零。 由于我想求解的方程不是那种形式,实际上将它们求解为 0 是我使用像 sympy 这样的库的目的,有没有办法解决这个问题?
文档的意思是,如果你做类似的事情
>>> solve(x**2 - 1, x)
然后solve隐含地假设x**2 - 1等于0。如果你想解决x**2 - 1 = 2,那么你可以2从两边减去,得到
solve
x**2 - 1
0
x**2 - 1 = 2
2
>>> solve(x**2 - 1 - 2, x)
或者你可以使用这个Eq()类
Eq()
>>> solve(Eq(x**2 - 1, 2), x)