📜  python 用两个变量求解方程 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:40.903000             🧑  作者: Mango

代码示例1
from sympy import symbols, Eq, solve
x, y = symbols('x y')
eq1 = Eq(2*x  + y - 1)  # i.e.  2x+y−1=0  is eq 1
eq2 = Eq(x + y - 5)    # i.e.  x+y−5=0   is eq 2
sol = solve((eq1, eq2),(x, y))
print(sol)
''' 
Output:
 SymPyDeprecationWarning(
{x: -4, y: 9}
'''