tanh

tanh(x)

Try it yourself:

See also:

tanh(): hyperbolic tangent

tanh(x) returns the hyperbolic tangent of x. Unlike ordinary tangent, its real output stays between −1 and 1.

Behavior

tanh(0) is 0. As x grows positive it approaches 1; as x grows negative it approaches −1. This smooth bounded behavior is useful in modeling and activation functions.

Related functions

Use atanh() for the inverse on the interval (−1, 1), and sinh() or cosh() for related hyperbolic functions. exp() underlies its exponential formula, while abs() checks magnitude.

Caveat

Do not confuse tanh with tan(); they have different geometry and domains.

Try Tanh in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions