UNPKG

1 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function cube
4
5Compute the cube of a value, `x * x * x`.
6For matrices, the function is evaluated element wise.
7
8
9## Syntax
10
11```js
12math.cube(x)
13```
14
15### Parameters
16
17Parameter | Type | Description
18--------- | ---- | -----------
19`x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit | Number for which to calculate the cube
20
21### Returns
22
23Type | Description
24---- | -----------
25number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit | Cube of x
26
27
28## Examples
29
30```js
31math.cube(2) // returns number 8
32math.pow(2, 3) // returns number 8
33math.cube(4) // returns number 64
344 * 4 * 4 // returns number 64
35
36math.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)