UNPKG

1.54 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function cbrt
4
5Calculate the cubic root of a value.
6
7For matrices, the function is evaluated element wise.
8
9
10## Syntax
11
12```js
13math.cbrt(x)
14math.cbrt(x, allRoots)
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`x` | number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; 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
26Type | Description
27---- | -----------
28number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Returns the cubic root of `x`
29
30
31## Examples
32
33```js
34math.cbrt(27) // returns 3
35math.cube(3) // returns 27
36math.cbrt(-64) // returns -4
37math.cbrt(math.unit('27 m^3')) // returns Unit 3 m
38math.cbrt([27, 64, 125]) // returns [3, 4, 5]
39
40const x = math.complex('8i')
41math.cbrt(x) // returns Complex 1.7320508075689 + i
42math.cbrt(x, true) // returns Matrix [
43 // 1.7320508075689 + i
44 // -1.7320508075689 + i
45 // -2i
46 // ]
47```
48
49
50## See also
51
52[square](square.md),
53[sqrt](sqrt.md),
54[cube](cube.md)