Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python solve equation with two variables

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}
'''
 
PREVIOUS NEXT
Tagged: #python #solve #equation #variables
ADD COMMENT
Topic
Name
5+1 =