當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python cmath.atanh()用法及代碼示例

cMath模塊包含許多函數,這些函數用於對複數進行數學運算。 cmath.atanh()函數返回複數的反雙曲反正切值。在此函數中傳遞的值可以是int,float和複數。

用法: cmath.
阿坦(X)

參數:此方法僅接受單個參數。

  • x:此參數是要傳遞給的值atanh()

返回值:此函數返回複數的反雙曲反正切值。

以下示例說明了上述函數的用法:

範例1:在此示例中,我們可以看到,通過使用cmath.atanh()方法,我們可以通過將反雙曲反正切值傳遞給任何值來獲得反雙曲正切值。

Python3

# Python code to implement 
# the atanh()function 
        
# importing "cmath" 
# for mathematical operations   
import cmath  
    
# using cmath.atanh() method  
val = cmath.atanh(3)  
    
print(val)

輸出:

(0.34657359027997264+1.5707963267948966j)

範例2:

Python3

# Python code to implement 
# the atanh()function 
        
# importing "cmath" 
# for mathematical operations   
import cmath  
    
# using cmath.atanh() method  
val = cmath.atanh(2 + 5j)  
    
print(val)

輸出:

(0.06706599664866984+1.399284356584545j)

相關用法


注:本文由純淨天空篩選整理自SHUBHAMSINGH10大神的英文原創作品 Python – cmath.atanh() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。