Thursday, September 4, 2025
HomeLanguagessympy.frac() method in Python

sympy.frac() method in Python

The sympy.frac(x) function represents the fractional part of x. For real numbers, it is defined as, x – [x] 
 

Syntax : sympy.frac() 

Return : Return the simplified mathematical expression. 

Example #1 : 

Python3




# import sympy 
from sympy import *
    
# Use sympy.frac() method 
gfg = frac(5.36)
      
print(gfg)


Output : 

0.36

Example #2 :

Python3




# import sympy 
from sympy import *
    
# Use sympy.frac() method 
gfg = frac(Rational(7, 5))
      
print(gfg)


Output : 

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

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6632 POSTS0 COMMENTS
Nicole Veronica
11800 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11860 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS