UNPKG

1.02 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function nthRoot
4
5Calculate the nth root of a value.
6The principal nth root of a positive real number A, is the positive real
7solution of the equation
8
9 x^root = A
10
11For matrices, the function is evaluated element wise.
12
13
14## Syntax
15
16```js
17math.nthRoot(a)
18math.nthRoot(a, root)
19```
20
21### Parameters
22
23Parameter | Type | Description
24--------- | ---- | -----------
25`a` | number &#124; BigNumber &#124; Array &#124; Matrix &#124; Complex | Value for which to calculate the nth root
26`root` | number &#124; BigNumber | The root. Default value: 2.
27
28### Returns
29
30Type | Description
31---- | -----------
32number &#124; Complex &#124; Array &#124; Matrix | Returns the nth root of `a`
33
34
35## Examples
36
37```js
38math.nthRoot(9, 2) // returns 3, as 3^2 == 9
39math.sqrt(9) // returns 3, as 3^2 == 9
40math.nthRoot(64, 3) // returns 4, as 4^3 == 64
41```
42
43
44## See also
45
46[sqrt](sqrt.md),
47[pow](pow.md)