1 |
|
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 | ## Examples
|
29 |
|
30 | ```js
|
31 | math.cube(2) // returns number 8
|
32 | math.pow(2, 3) // returns number 8
|
33 | math.cube(4) // returns number 64
|
34 | 4 * 4 * 4 // returns number 64
|
35 |
|
36 | math.cube([1, 2, 3, 4]) // returns Array [1, 8, 27, 64]
|
37 | ```
|
38 |
|
39 |
|
40 | ## See also
|
41 |
|
42 | [multiply](multiply.md),
|
43 | [square](square.md),
|
44 | [pow](pow.md),
|
45 | [cbrt](cbrt.md)
|