函数参数 #
计算复数值的参数。对于复数 a + bi,参数的计算方法为 atan2(b, a)。
对于矩阵,该函数逐元素求值。
Syntax #
math.arg(x)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
number | BigNumber | Complex | Array | Matrix | 复数或包含复数的数组 |
Returns #
| Type | Description |
|---|---|
| number | BigNumber | Array | Matrix | x 的参数 |
Throws #
Type | Description —- | ———–
Examples #
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