Python math - tanh() Function
The Python math.tanh() function returns hyperbolic tangent of a value. The hyperbolic tangent of x is defined as:
where e is an Euler's number.
Syntax
math.tanh(x)
Parameters
x |
Required. Specify the value. |
Return Value
Returns the hyperbolic tangent of a value.
Example:
In the example below, tanh() function is used to find out the hyperbolic tangent of a value.
import math print(math.tanh(0)) print(math.tanh(2)) print(math.tanh(4))
The output of the above code will be:
0.0 0.9640275800758169 0.999329299739067
❮ Python Math Module