函数 cbrt #

计算值的立方根。

为避免与矩阵的立方根混淆,此函数不适用于矩阵。要逐元素计算矩阵的立方根,请参阅示例。

Syntax #

math.cbrt(x)
math.cbrt(x, allRoots)

Parameters #

Parameter Type Description
x number | BigNumber | Complex | Unit 用于计算立方根的值。
allRoots boolean 可选,默认为 false。仅当 x 是数字或复数时适用。如果为 true,则返回所有复数根;如果为 false(默认),则返回主根。

Returns #

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

Throws #

Type | Description —- | ———–

Examples #

math.cbrt(27)                  // returns 3
math.cube(3)                   // returns 27
math.cbrt(-64)                 // returns -4
math.cbrt(math.unit('27 m^3')) // returns Unit 3 m
math.map([27, 64, 125], x => math.cbrt(x))       // returns [3, 4, 5]

const x = math.complex('8i')
math.cbrt(x)                   // returns Complex 1.7320508075689 + i
math.cbrt(x, true)             // returns Matrix [
                                //    1.7320508075689 + i
                                //   -1.7320508075689 + i
                                //   -2i
                                // ]

另请参阅 #

square, sqrt, cube

Fork me on GitHub