Search
 
SCRIPT & CODE EXAMPLE
 

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}
'''
Comment

PREVIOUS NEXT
Code Example
Python :: django post request 403 forbidden 
Python :: how to add 30 minutes in datetime column in pandas 
Python :: python loop x times 
Python :: shutil move overwrite 
Python :: py how to deactivate venv 
Python :: how to create a role and give it to the author discord.py 
Python :: Python loop to run for certain amount of seconds 
Python :: move the mouse in games python 
Python :: delete specific indeces from numpy array 
Python :: how to reference a file in python 
Python :: errno 13 permission denied python 
Python :: length of a matrix in python 
Python :: rotate image by specific angle opencv 
Python :: Flatten List in Python Using List Comprehension 
Python :: torchvision.transforms 
Python :: how to sort dictionary in python by lambda 
Python :: python check if array is sorted 
Python :: python pd.DataFrame.from_records remove header 
Python :: django redirect to external url 
Python :: Delete file in python Using the pathlib module 
Python :: how to check django rest framework version 
Python :: how to do date time formatting with strftime in python 
Python :: pytest check exception 
Python :: how to restart program in python 
Python :: assigning values in python 
Python :: Concatenate strings from several rows using Pandas groupby 
Python :: pandas dataframe from tsv 
Python :: python make directory tree from path 
Python :: pandas read column in date format 
Python :: pip is not a batch command but python is installed 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =