Python cmath.sinh() Function
The Python cmath.sinh() function returns the hyperbolic sine of complex numbers.
The hyperbolic sine function is denoted as sinh(x). The mathematical function, which specifies the inverse sine function, calculates the value of the sine, i.e complex number or a real number of x.
The mathematical representation of the hyperbolic sine function is defined as −
sinh(x) = (ex - e-x)/ 2
Where e(e=2.71828) is the base of the natural logarithm. This function is symmetric with respect to the origin: sinh(-x) = -sinh(X).
Syntax
Following is the basic syntax of the Python cmath.sinh() function −
cmath.sinh(x)
Parameters
This function accepts a single real number, for which we need to find the hyperbolic sine as a parameter.
Return Value
This function returns the hyperbolic sine of the given complex number.
Example 1
In the below example, we are calculating the hyperbolic sine of the positive complex numbers using the cmath.sinh() function −
import cmath x = 2+3j result = cmath.sinh(x) print(result)
Output
The output obtained is as follows −
(-3.59056458998578+0.5309210862485197j)
Example 2
When we pass a fraction value to the cmath.sinh() function, then it returns a complex number −
import cmath from fractions import Fraction x = Fraction(4, -10) result = cmath.sinh(x) print(result)
Output
Following is the output of the above code −
(-0.4107523258028155+0j)
Example 3
In the below example, we are retrieving the hyperbolic sine of a negative number using the cmath.sinh() function −
import cmath x = -0.7 result = cmath.sinh(x) print(result)
Output
We will get the following output −
(-0.7585837018395334+0j)
Example 4
In the following example, we are creating a loop to create a hyperbolic sine value using the cmath.sinh() function. This loop iterates through each value in the list.
import cmath
values = [2.0, 4.0, 6.0]
for x in values:
result = cmath.sinh(x)
print("sinh({}) = {}".format(x, result))
Output
We will get the output as shown below −
sinh(2.0) = (3.626860407847019+0j) sinh(4.0) = (27.28991719712775+0j) sinh(6.0) = (201.71315737027922+0j)
python_modules.htm