mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.4 KiB
1.4 KiB
| layout |
|---|
| default |
Function cube #
Compute the cube of a value, x * x * x.
For matrices, the function is evaluated element wise.
Syntax #
math.cube(x)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
number | BigNumber | Fraction | Complex | Array | Matrix | Unit | Number for which to calculate the cube |
Returns #
| Type | Description |
|---|---|
| number | BigNumber | Fraction | Complex | Array | Matrix | Unit | Cube of x |
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.cube([1, 2, 3, 4]); // returns Array [1, 8, 27, 64]