Python中的 sympy.frac() 方法
sympy.frac(x)函数表示 x 的小数部分。对于实数,它被定义为, x – [x]
Syntax : sympy.frac()
Return : Return the simplified mathematical expression.
示例 #1:
Python3
# import sympy
from sympy import *
# Use sympy.frac() method
gfg = frac(5.36)
print(gfg)
Python3
# import sympy
from sympy import *
# Use sympy.frac() method
gfg = frac(Rational(7, 5))
print(gfg)
输出 :
0.36
示例 #2:
Python3
# import sympy
from sympy import *
# Use sympy.frac() method
gfg = frac(Rational(7, 5))
print(gfg)
输出 :
2 / 5