2022-03-01 13:04:09 +01:00

58 lines
1.5 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-arg">Function arg <a href="#function-arg" title="Permalink">#</a></h1>
Compute the argument of a complex value.
For a complex number `a + bi`, the argument is computed as `atan2(b, a)`.
For matrices, the function is evaluated element wise.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.arg(x)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix | A complex number or array with complex numbers
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
number &#124; BigNumber &#124; Array &#124; Matrix | The argument of x
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
const a = math.complex(2, 2)
math.arg(a) / math.pi // returns number 0.25
const b = math.complex('2 + 3i')
math.arg(b) // returns number 0.982793723247329
math.atan2(3, 2) // returns number 0.982793723247329
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[re](re.html),
[im](im.html),
[conj](conj.html),
[abs](abs.html)