Python – cmath.sinh()函数
cmath是用于复数数学的Python内置模块。 cmath 模块有一个方法 sinh(),它返回传递给它的复数的双曲正弦。
Syntax: cmath.sinh(Z)
Parameter: It requires only one parameter i.e the number for which hyperbolic sine needs to be calculated.
Return: Returns a complex number that is the hyperbolic sine of the number passed.
示例 1:
Python3
# Import the Library
import cmath
# Printing the result
print (cmath.sinh(5 + 3j))
Python3
# Import the Library
import cmath
# Printing the result
print (cmath.sinh(1))
Python3
# Import the Library
import cmath
# Printing the result
print (cmath.sinh())
输出:
(-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)