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


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

cmath是用於複數數學的python 內置模塊。 cmath模塊具有方法sinh(),該方法返回傳遞給它的複數的雙曲正弦值。

用法: cmath.sinh(Z)

參數:它僅需要一個參數,即需要為其計算雙曲正弦的數字。

返回:返回一個複數,它是傳遞的數字的雙曲正弦值。

範例1:



Python3

# Import the Library 
import cmath  
  
# Printing the result 
print (cmath.sinh(5 + 3j))

輸出:

(-73.46062169567368+10.472508533940392j)

範例2:在此示例中,傳遞了實數,但返回的結果仍然是複數。

Python3

# Import the Library 
import cmath  
  
# Printing the result 
print (cmath.sinh(1))

輸出:

(1.1752011936438014+0j)

範例3:在此示例中,沒有傳遞參數,在這種情況下將拋出TypeError

Python3

# Import the Library 
import cmath  
  
# Printing the result 
print (cmath.sinh())

輸出:

TypeError:sinh() takes exactly one argument (0 given)



相關用法


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