1 |
|
2 |
|
3 | # Function arg
|
4 |
|
5 | Compute the argument of a complex value.
|
6 | For a complex number `a + bi`, the argument is computed as `atan2(b, a)`.
|
7 |
|
8 | For matrices, the function is evaluated element wise.
|
9 |
|
10 |
|
11 | ## Syntax
|
12 |
|
13 | ```js
|
14 | math.arg(x)
|
15 | ```
|
16 |
|
17 | ### Parameters
|
18 |
|
19 | Parameter | Type | Description
|
20 | --------- | ---- | -----------
|
21 | `x` | number | BigNumber | Complex | Array | Matrix | A complex number or array with complex numbers
|
22 |
|
23 | ### Returns
|
24 |
|
25 | Type | Description
|
26 | ---- | -----------
|
27 | number | BigNumber | Array | Matrix | The argument of x
|
28 |
|
29 |
|
30 | ## Examples
|
31 |
|
32 | ```js
|
33 | const a = math.complex(2, 2)
|
34 | math.arg(a) / math.pi // returns number 0.25
|
35 |
|
36 | const b = math.complex('2 + 3i')
|
37 | math.arg(b) // returns number 0.982793723247329
|
38 | math.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)
|