UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

46 lines (29 loc) 1 kB
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # Function cube Compute the cube of a value, `x * x * x`. For matrices, the function is evaluated element wise. ## Syntax ```js math.cube(x) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit | Number for which to calculate the cube ### Returns Type | Description ---- | ----------- number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit | Cube of x ## Examples ```js 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] ``` ## See also [multiply](multiply.md), [square](square.md), [pow](pow.md), [cbrt](cbrt.md)