nthRoots.md (1073B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 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 ### Throws 32 33 Type | Description 34 ---- | ----------- 35 36 37 ## Examples 38 39 ```js 40 math.nthRoots(1) 41 // returns [ 42 // {re: 1, im: 0}, 43 // {re: -1, im: 0} 44 // ] 45 nthRoots(1, 3) 46 // returns [ 47 // { re: 1, im: 0 }, 48 // { re: -0.4999999999999998, im: 0.8660254037844387 }, 49 // { re: -0.5000000000000004, im: -0.8660254037844385 } 50 ] 51 ``` 52 53 54 ## See also 55 56 [nthRoot](nthRoot.md), 57 [pow](pow.md), 58 [sqrt](sqrt.md)