Function tanh #

Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1).

To avoid confusion with matrix hyperbolic tangent, this function does not apply to matrices.

Syntax #

math.tanh(x)

Parameters #

Parameter Type Description
x number | BigNumber | Complex Function input

Returns #

Type Description
number | BigNumber | Complex Hyperbolic tangent of x

Throws #

Type | Description —- | ———–

Examples #

// tanh(x) = sinh(x) / cosh(x) = 1 / coth(x)
math.tanh(0.5)                   // returns 0.46211715726000974
math.sinh(0.5) / math.cosh(0.5)  // returns 0.46211715726000974
1 / math.coth(0.5)               // returns 0.46211715726000974

See also #

sinh, cosh, coth

Fork me on GitHub