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 nthRoots
4
5Calculate the nth roots of a value.
6An nth root of a positive real number A,
7is a positive real solution of the equation "x^root = A".
8This function returns an array of complex values.
9
10
11## Syntax
12
13```js
14math.nthRoots(x)
15math.nthRoots(x, root)
16```
17
18### Parameters
19
20Parameter | Type | Description
21--------- | ---- | -----------
22`x` | number &#124; BigNumber &#124; Fraction &#124; Complex | Number to be rounded
23
24### Returns
25
26Type | Description
27---- | -----------
28number &#124; BigNumber &#124; Fraction &#124; Complex | Rounded value
29
30
31## Examples
32
33```js
34math.nthRoots(1)
35// returns [
36// {re: 1, im: 0},
37// {re: -1, im: 0}
38// ]
39nthRoots(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)