Skip to content
Related Articles

Related Articles

sympy.frac() method in Python
  • Last Updated : 29 Jul, 2020

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

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :