Python math.tanh() – Hyperbolic Tangent

Python math.tanh()

math.tanh(x) function returns the hyperbolic tangent of x.

tanh(x) = (e^2x – 1)/(e^2x + 1)

Syntax

The syntax to call tanh() function is

math.tanh(x)

where

Parameter Required Description
x Yes A numeric value.

Examples

In the following example, we find the hyperbolic tangent of 5, using tanh() function of math module.

Python Program

import math

x = 5
result = math.tanh(x)
print('tanh(x) :', result)
Run Code

Output

tanh(x) : 0.9999092042625951

Summary

In this Python Examples tutorial, we learned the syntax of, and examples for math.tanh() function.

Related Tutorials

Privacy Policy Terms of Use

SitemapContact Us