cMath模塊包含許多函數,用於複數的數學運算。的cmath.acos()函數返回複數的反餘弦值。在此函數中傳遞的值可以是整型,浮點數,和複雜數字。
用法: cmath.acos(x)
參數:此方法僅接受單個參數。
- x:此參數是要傳遞給acos()的值
返回值:此函數返回a的反餘弦值複雜數。
以下示例說明了上述函數的用法:
範例1:在這個例子中,我們可以通過使用cmath.acos() 方法,我們能夠獲得餘弦通過傳遞任何值給它。
Python3
# Python code to implement
# the acos()function
# importing "cmath"
# for mathematical operations
import cmath
# using cmath.acos() method
val = cmath.acos(3)
print(val)
輸出:
-1.762747174039086j
範例2:
Python3
# Python code to implement
# the acos()function
# importing "cmath"
# for mathematical operations
import cmath
# using cmath.acos() method
val = cmath.acos(2 + 5j)
print(val)
輸出:
(1.1961255219693696-2.3830308809003258j)
相關用法
- Python Wand function()用法及代碼示例
- Python int()用法及代碼示例
- Python id()用法及代碼示例
- Python cmp()用法及代碼示例
- Python oct()用法及代碼示例
- Python str()用法及代碼示例
- Python map()用法及代碼示例
- Python now()用法及代碼示例
- Python dir()用法及代碼示例
- Python ord()用法及代碼示例
- Python tell()用法及代碼示例
- Python sum()用法及代碼示例
- Python hex()用法及代碼示例
- Python Wand arc()用法及代碼示例
- Python locals()用法及代碼示例
- Python join()用法及代碼示例
- Python Union()用法及代碼示例
注:本文由純淨天空篩選整理自SHUBHAMSINGH10大神的英文原創作品 Python – cmath.acos() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。