1 |
|
2 |
|
3 | # Function tan
|
4 |
|
5 | Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`.
|
6 |
|
7 | For matrices, the function is evaluated element wise.
|
8 |
|
9 |
|
10 | ## Syntax
|
11 |
|
12 | ```js
|
13 | math.tan(x)
|
14 | ```
|
15 |
|
16 | ### Parameters
|
17 |
|
18 | Parameter | Type | Description
|
19 | --------- | ---- | -----------
|
20 | `x` | number | BigNumber | Complex | Unit | Array | Matrix | Function input
|
21 |
|
22 | ### Returns
|
23 |
|
24 | Type | Description
|
25 | ---- | -----------
|
26 | number | BigNumber | Complex | Array | Matrix | Tangent of x
|
27 |
|
28 |
|
29 | ## Examples
|
30 |
|
31 | ```js
|
32 | math.tan(0.5) // returns number 0.5463024898437905
|
33 | math.sin(0.5) / math.cos(0.5) // returns number 0.5463024898437905
|
34 | math.tan(math.pi / 4) // returns number 1
|
35 | math.tan(math.unit(45, 'deg')) // returns number 1
|
36 | ```
|
37 |
|
38 |
|
39 | ## See also
|
40 |
|
41 | [atan](atan.md),
|
42 | [sin](sin.md),
|
43 | [cos](cos.md)
|