Function cube #
Compute the cube of a value, x * x * x.
To avoid confusion with pow(M,3), this function does not apply to matrices.
If you wish to cube every entry of a matrix, see the examples.
Syntax #
math.cube(x)
Parameters #
| Parameter |
Type |
Description |
x |
number | BigNumber | bigint | Fraction | Complex | Unit |
Number for which to calculate the cube |
Returns #
| Type |
Description |
| number | BigNumber | bigint | Fraction | Complex | Unit |
Cube of x |
Throws #
Examples #
math.cube(2) // returns number 8
math.pow(2, 3) // returns number 8
math.cube(4) // returns number 64
4 * 4 * 4 // returns number 64
math.map([1, 2, 3, 4], math.cube) // returns Array [1, 8, 27, 64]
See also #
multiply,
square,
pow,
cbrt