1 |
|
2 |
|
3 | # Function nthRoots
|
4 |
|
5 | Calculate the nth roots of a value.
|
6 | An nth root of a positive real number A,
|
7 | is a positive real solution of the equation "x^root = A".
|
8 | This function returns an array of complex values.
|
9 |
|
10 |
|
11 | ## Syntax
|
12 |
|
13 | ```js
|
14 | math.nthRoots(x)
|
15 | math.nthRoots(x, root)
|
16 | ```
|
17 |
|
18 | ### Parameters
|
19 |
|
20 | Parameter | Type | Description
|
21 | --------- | ---- | -----------
|
22 | `x` | number | BigNumber | Fraction | Complex | Number to be rounded
|
23 |
|
24 | ### Returns
|
25 |
|
26 | Type | Description
|
27 | ---- | -----------
|
28 | number | BigNumber | Fraction | Complex | Rounded value
|
29 |
|
30 |
|
31 | ## Examples
|
32 |
|
33 | ```js
|
34 | math.nthRoots(1)
|
35 | // returns [
|
36 | // {re: 1, im: 0},
|
37 | // {re: -1, im: 0}
|
38 | // ]
|
39 | nthRoots(1, 3)
|
40 | // returns [
|
41 | // { re: 1, im: 0 },
|
42 | // { re: -0.4999999999999998, im: 0.8660254037844387 },
|
43 | // { re: -0.5000000000000004, im: -0.8660254037844385 }
|
44 | ]
|
45 | ```
|
46 |
|
47 |
|
48 | ## See also
|
49 |
|
50 | [nthRoot](nthRoot.md),
|
51 | [pow](pow.md),
|
52 | [sqrt](sqrt.md)
|