UNPKG

1.02 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function arg
4
5Compute the argument of a complex value.
6For a complex number `a + bi`, the argument is computed as `atan2(b, a)`.
7
8For matrices, the function is evaluated element wise.
9
10
11## Syntax
12
13```js
14math.arg(x)
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`x` | number &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix | A complex number or array with complex numbers
22
23### Returns
24
25Type | Description
26---- | -----------
27number &#124; BigNumber &#124; Array &#124; Matrix | The argument of x
28
29
30## Examples
31
32```js
33const a = math.complex(2, 2)
34math.arg(a) / math.pi // returns number 0.25
35
36const b = math.complex('2 + 3i')
37math.arg(b) // returns number 0.982793723247329
38math.atan2(3, 2) // returns number 0.982793723247329
39```
40
41
42## See also
43
44[re](re.md),
45[im](im.md),
46[conj](conj.md),
47[abs](abs.md)