Function cbrt
Calculate the cubic root of a value.
For matrices, the function is evaluated element wise.
Syntax
cbrt(x)
cbrt(x, allRoots)
Parameters
Parameter | Type | Description |
---|---|---|
x |
number | BigNumber | Complex | Unit | Array | Matrix | Value for which to calculate the cubic root. |
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. |
Returns
Type | Description |
---|---|
number | BigNumber | Complex | Unit | Array | Matrix | Returns the cubic root of x |
Examples
cbrt(27); // returns 3
cube(3); // returns 27
cbrt(-64); // returns -4
cbrt(unit('27 m^3')); // returns Unit 3 m
cbrt([27, 64, 125]); // returns [3, 4, 5]
var x = complex('8i');
cbrt(x); // returns Complex 1.7320508075689 + i
cbrt(x, true); // returns Matrix [
// 1.7320508075689 + i
// -1.7320508075689 + i
// -2i
// ]