Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python math.tanh() function is used to return hyperbolic tangent of a value. The hyperbolic tangent of x is defined as:

tanh

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 below example, 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