UNPKG

1.06 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function atan2
4
5Calculate the inverse tangent function with two arguments, y/x.
6By providing two arguments, the right quadrant of the computed angle can be
7determined.
8
9For matrices, the function is evaluated element wise.
10
11
12## Syntax
13
14```js
15math.atan2(y, x)
16```
17
18### Parameters
19
20Parameter | Type | Description
21--------- | ---- | -----------
22`y` | number &#124; Array &#124; Matrix | Second dimension
23`x` | number &#124; Array &#124; Matrix | First dimension
24
25### Returns
26
27Type | Description
28---- | -----------
29number &#124; Array &#124; Matrix | Four-quadrant inverse tangent
30
31
32## Examples
33
34```js
35math.atan2(2, 2) / math.pi // returns number 0.25
36
37const angle = math.unit(60, 'deg') // returns Unit 60 deg
38const x = math.cos(angle)
39const y = math.sin(angle)
40
41math.atan(2) // returns Complex 1.5707963267948966 -1.3169578969248166 i
42```
43
44
45## See also
46
47[tan](tan.md),
48[atan](atan.md),
49[sin](sin.md),
50[cos](cos.md)