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