cube.md (1057B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function cube 4 5 Compute the cube of a value, `x * x * x`. 6 For matrices, the function is evaluated element wise. 7 8 9 ## Syntax 10 11 ```js 12 math.cube(x) 13 ``` 14 15 ### Parameters 16 17 Parameter | Type | Description 18 --------- | ---- | ----------- 19 `x` | number | BigNumber | Fraction | Complex | Array | Matrix | Unit | Number for which to calculate the cube 20 21 ### Returns 22 23 Type | Description 24 ---- | ----------- 25 number | BigNumber | Fraction | Complex | Array | Matrix | Unit | Cube of x 26 27 28 ### Throws 29 30 Type | Description 31 ---- | ----------- 32 33 34 ## Examples 35 36 ```js 37 math.cube(2) // returns number 8 38 math.pow(2, 3) // returns number 8 39 math.cube(4) // returns number 64 40 4 * 4 * 4 // returns number 64 41 42 math.cube([1, 2, 3, 4]) // returns Array [1, 8, 27, 64] 43 ``` 44 45 46 ## See also 47 48 [multiply](multiply.md), 49 [square](square.md), 50 [pow](pow.md), 51 [cbrt](cbrt.md)