cbrt.md (1595B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function cbrt 4 5 Calculate the cubic root of a value. 6 7 For matrices, the function is evaluated element wise. 8 9 10 ## Syntax 11 12 ```js 13 math.cbrt(x) 14 math.cbrt(x, allRoots) 15 ``` 16 17 ### Parameters 18 19 Parameter | Type | Description 20 --------- | ---- | ----------- 21 `x` | number | BigNumber | Complex | Unit | Array | Matrix | Value for which to calculate the cubic root. 22 `allRoots` | boolean | Optional, false by default. Only applicable when `x` is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned. 23 24 ### Returns 25 26 Type | Description 27 ---- | ----------- 28 number | BigNumber | Complex | Unit | Array | Matrix | Returns the cubic root of `x` 29 30 31 ### Throws 32 33 Type | Description 34 ---- | ----------- 35 36 37 ## Examples 38 39 ```js 40 math.cbrt(27) // returns 3 41 math.cube(3) // returns 27 42 math.cbrt(-64) // returns -4 43 math.cbrt(math.unit('27 m^3')) // returns Unit 3 m 44 math.cbrt([27, 64, 125]) // returns [3, 4, 5] 45 46 const x = math.complex('8i') 47 math.cbrt(x) // returns Complex 1.7320508075689 + i 48 math.cbrt(x, true) // returns Matrix [ 49 // 1.7320508075689 + i 50 // -1.7320508075689 + i 51 // -2i 52 // ] 53 ``` 54 55 56 ## See also 57 58 [square](square.md), 59 [sqrt](sqrt.md), 60 [cube](cube.md)