函数 nthRoot #
计算一个值的n次方根。正实数A的主n次方根是方程的实数解
x^root = A
对于矩阵,该函数逐元素求值。
Syntax #
math.nthRoot(a)
math.nthRoot(a, root)
Parameters #
| Parameter | Type | Description |
|---|---|---|
a |
number | BigNumber | Array | Matrix | Complex | 计算n次方根的值 |
root |
number | BigNumber | 根。默认值:2。 |
Returns #
| Type | Description |
|---|---|
| number | Complex | Array | Matrix | 返回 a 的n次方根 |
Throws #
Type | Description —- | ———–
Examples #
math.nthRoot(9, 2) // returns 3 (since 3^2 == 9)
math.sqrt(9) // returns 3 (since 3^2 == 9)
math.nthRoot(64, 3) // returns 4 (since 4^3 == 64)