sympy's solve() command for equations != 0

前端 未结 1 1904
情深已故
情深已故 2021-01-28 20:04

As i\'ve read in the sympy docs, the solve() command expects an equation to solve as being equal to zero.
As the equations i would like to solve are not in that form and in

1条回答
  •  醉梦人生
    2021-01-28 21:08

    What the docs are saying is that if you do something like

    >>> solve(x**2 - 1, x)
    

    Then solve is implicitly assuming that x**2 - 1 is equal to 0. If you wanted to solve x**2 - 1 = 2, then you could either subtract 2 from both sides, to get

    >>> solve(x**2 - 1 - 2, x)
    

    or you could use the Eq() class

    >>> solve(Eq(x**2 - 1, 2), x)
    

    0 讨论(0)
提交回复
热议问题