Friday, September 5, 2025
HomeLanguagesPython | sympy Relational() method

Python | sympy Relational() method

With the help of sympy.core.relational.Relational() method, we are going make the relations between two variables and constants by using sympy.core.relational.Relational() method.

Syntax : sympy.core.relational.Relational(var1, var2, "rel")

Return : Return a relationship between two variables.

Example #1 :
In this example we can see that by using sympy.core.relational.Relational() method, we are able to create the relationship between two variables.




# import sympy and Relational
from sympy.core.relational import Relational
from sympy import * 
  
x, y = symbols('x y')
  
# Using sympy.core.relational.Relational(var1, var2, "rel") method
gfg = Relational(x, y, ">=")
  
print(gfg)


Output :

x >= y

Example #2 :




# import sympy and Relational
from sympy.core.relational import Relational
from sympy import * 
  
x, y = symbols('x y')
  
# Using sympy.core.relational.Relational(var1, var2, "rel") method
gfg = Relational(x, y, "!=")
  
print(gfg)


Output :

Ne(x, y)

Last Updated :
13 Aug, 2019
Like Article
Save Article

<!–

–>

Similar Reads
Related Tutorials
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32269 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6638 POSTS0 COMMENTS
Nicole Veronica
11802 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11866 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7027 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS