Function nthRoot #

Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation

x^root = A

For matrices, the function is evaluated element wise.

Syntax #

math.nthRoot(a)
math.nthRoot(a, root)

Parameters #

Parameter Type Description
a number | BigNumber | Array | Matrix | Complex Value for which to calculate the nth root
root number | BigNumber The root. Default value: 2.

Returns #

Type Description
number | Complex | Array | Matrix Returns the nth root of a

Throws #

Type | Description —- | ———–

Examples #

math.nthRoot(9, 2)    // returns 3
math.sqrt(9)          // returns 3
math.nthRoot(64, 3)   // returns 4

See also #

sqrt, pow

History #

Version Comment
v11.6 Support matrix broadcasting
v5.0.0 Improve consistency with sqrt and pow
v3.1.1 Support negative roots of zero
v2.4.1 Support negative values like nthRoot(-2, 3)
v2 Support roots of Complex
v1.1 Created
Fork me on GitHub