The math.sinh() method is used to return the hyperbolic sine of a given number.
Syntax
import math
math.sinh(num)
Parameter
num(required): A number for which you want to calculate the hyperbolic sine.
Return Value
Returns a hyperbolic sine value of the number in the float datatype.
If the num is not a number, it raises TypeError.
Visual Representation
Example 1: How to Use math.sinh() Method
import math
print (math.sinh(1))
print (math.sinh(4))
print (math.sinh(-4))
print (math.sinh(15.35))
Output
1.1752011936438014
27.289917197127753
-27.289917197127753
2319478.234531276
Example 2: Plotting
import matplotlib.pyplot as plt
import math
# Create a list of x values from -10 to 10
x_values = [x * 0.01 for x in range(-1000, 1000)]
# Calculate the corresponding y values
y_values = [math.sinh(x) for x in x_values]
# Create the plot
plt.plot(x_values, y_values)
# Add labels and a title
plt.xlabel('x')
plt.ylabel('sinh(x)')
plt.title('Plot of the sinh function')
# Display the plot
plt.show()
Output