函数 im #
获取复数的虚部。对于复数 a + bi,该函数返回 b。
对于矩阵,该函数逐元素求值。
Syntax #
math.im(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, 3)
math.re(a) // returns number 2
math.im(a) // returns number 3
math.re(math.complex('-5.2i')) // returns number -5.2
math.re(math.complex(2.4)) // returns number 0