The Python math.sinh() method returns the hyperbolic sine of a given number.
The hyperbolic sine method, denoted as sinh(x), is a mathematical method that calculates the value of the sine of a complex number or a real number x. It returns real values that grow exponentially as x increases.
Mathematically, the hyperbolic sine method is defined as −
sinh(x) = (ex - e-x)/ 2
Where, e is the base of the natural logarithm, approximately equal to 2.71828. This method is odd, meaning that sinh(-x) = -sinh(X).
SyntaxFollowing is the basic syntax of the Python math.sinh() method −
math.sinh(x)Parameters
This method accepts a number (all real number) for which you want to find the hyperbolic sine as a parameter.
Return ValueThe method returns the hyperbolic sine of the given number.
Example 1In the following example, we calculate the hyperbolic sine of a positive number using the math.sinh() method −
import math x = 2.0 result = math.sinh(x) print(result)Output
The output obtained is as follows −
3.626860407847019Example 2
If we pass a fraction value to the math.sinh() method, it returns a real number −
import math from fractions import Fraction x = Fraction(5, -9) result = math.sinh(x) print(result)Output
Following is the output of the above code −
-0.5845777889480125Example 3
In here, we are retrieving the hyperbolic sine of a negative number using the math.sinh() method −
import math x = -0.5 result = math.sinh(x) print(result)Output
We get the output as shown below −
-0.5210953054937474Example 4
In this example, we use a loop to calculate the hyperbolic sine of multiple values using the math.sinh() method. The loop iterates through each value in the values list, calculates the hyperbolic sine, and prints the result for each value −
import math values = [1.0, 2.0, 3.0] for x in values: result = math.sinh(x) print("sinh({}) = {}".format(x, result))Output
The result produced is as shown below −
sinh(1.0) = 1.1752011936438014 sinh(2.0) = 3.626860407847019 sinh(3.0) = 10.017874927409903
python_maths.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4