函数 re #

获取复数的实部。对于复数 a + bi,该函数返回 a

对于矩阵,该函数逐元素求值。

Syntax #

math.re(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 0
math.re(math.complex(2.4))     // returns number 2.4

另请参阅 #

im, conj, abs, arg

Fork me on GitHub