UNPKG

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