tanh.md (1042B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function tanh 4 5 Calculate the hyperbolic tangent of a value, 6 defined as `tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1)`. 7 8 For matrices, the function is evaluated element wise. 9 10 11 ## Syntax 12 13 ```js 14 math.tanh(x) 15 ``` 16 17 ### Parameters 18 19 Parameter | Type | Description 20 --------- | ---- | ----------- 21 `x` | number | BigNumber | Complex | Unit | Array | Matrix | Function input 22 23 ### Returns 24 25 Type | Description 26 ---- | ----------- 27 number | BigNumber | Complex | Array | Matrix | Hyperbolic tangent of x 28 29 30 ### Throws 31 32 Type | Description 33 ---- | ----------- 34 35 36 ## Examples 37 38 ```js 39 // tanh(x) = sinh(x) / cosh(x) = 1 / coth(x) 40 math.tanh(0.5) // returns 0.46211715726000974 41 math.sinh(0.5) / math.cosh(0.5) // returns 0.46211715726000974 42 1 / math.coth(0.5) // returns 0.46211715726000974 43 ``` 44 45 46 ## See also 47 48 [sinh](sinh.md), 49 [cosh](cosh.md), 50 [coth](coth.md)