借助sympy.evalf()
方法,我們能夠評估數學表達式。
用法:sympy.evalf()
返回:Return the evaluated mathematical expression.
範例1:
在這個例子中,我們可以通過使用sympy.evalf()
方法,我們能夠評估數學表達式。
# Import sympy
from sympy import *
# Use sympy.evalf() method
expn = sqrt(9)
gfg = expn.evalf()
print(gfg)
輸出:
3.00000000000000
範例2:
# Import sympy
from sympy import *
# Use sympy.evalf() method
expn = sqrt(9)*cos(45)
gfg = expn.evalf()
print(gfg)
輸出:
1.57596596645319
相關用法
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python Decimal max()用法及代碼示例
- Python PIL ImageOps.fit()用法及代碼示例
- Python os.rmdir()用法及代碼示例
- Python sympy.det()用法及代碼示例
- Python Decimal min()用法及代碼示例
- Python os.readlink()用法及代碼示例
- Python os.writev()用法及代碼示例
- Python os.readv()用法及代碼示例
- Python PIL RankFilter()用法及代碼示例
- Python os.rename()用法及代碼示例
- Python os.sendfile()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy.evalf() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。