Function sqrt #

计算值的平方根。

对于矩阵,如果要计算方阵的矩阵平方根,请使用 sqrtm 函数。如果要对矩阵 M 进行逐元素应用 sqrt,请使用 math.map(M, math.sqrt)

Syntax #

math.sqrt(x)

Parameters #

Parameter Type Description
x number | BigNumber | Complex | Unit 用于计算平方根的值。

Returns #

Type Description
number | BigNumber | Complex | Unit 返回 x 的平方根

Throws #

Type | Description —- | ———–

Examples #

math.sqrt(25)                // returns 5
math.square(5)               // returns 25
math.sqrt(-4)                // returns Complex 2i

另请参阅 #

square, multiply, cube, cbrt, sqrtm

Fork me on GitHub