Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 fact solving them for 0 is my purpose in using a library like sympy, is there a way to get around this?

question from:https://stackoverflow.com/questions/65661876/can-you-set-equations-in-sympy-equal-to-something-other-than-0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
221 views
Welcome To Ask or Share your Answers For Others

1 Answer

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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...