tanh()
function is used to find the the hyperbolic tangent of the given input. Hyperbolic tangent means the analogue of an circular function used throughout trigonometry. This function is a part of python programming language.
Syntax of tanh()
Function
The syntax of tanh()
function in Python is:
math.tanh(x)
Parameters of tanh()
Function in Python
x
– Where x
is any valid python number (positive or negative). This parameter is required.Note: If the
x
parameter is not a number, tanh()
function will return an Error.
Compatibility
tanh()
function is available and compatible with both Python 2.x
and 3.x
. This function is a part of python standard math library.
Return Value of tanh()
Function in Python
tanh()
function returns the hyperbolic tangent for the given input (x
– parameter).
Python tanh()
Function Example
Here, we are using different values as an input and finding heir hyperbolic tan.
# import math library import math print(math.tanh(-0.10)) print(math.tanh(0)) print(math.tanh(0.17)) print(math.tanh(332)) print(math.tanh(-69253))
Output:
-0.09966799462495582
0.0
0.16838104587081473
1.0
-1.0