mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
47 lines
879 B
Markdown
47 lines
879 B
Markdown
# Function pow
|
|
|
|
Calculates the value of `x` to the power of `y`, `x ^ y`.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.pow(x, y)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | Number | BigNumber | Boolean | Complex | Array | Matrix | The base
|
|
`y` | Number | BigNumber | Boolean | Complex | The exponent
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Number | BigNumber | Complex | Array | Matrix | The value of `x` to the power `y`
|
|
|
|
|
|
## Examples
|
|
|
|
TODO: examples
|
|
|
|
```js
|
|
var math = mathjs();
|
|
|
|
math.pow(2, 3); // returns Number 8
|
|
|
|
var a = math.complex(2, 3);
|
|
math.pow(a, 2) // returns Complex -5 + 12i
|
|
|
|
var b = [[1, 2], [4, 3]];
|
|
math.pow(b, 2); // returns Array [[9, 8], [16, 17]]
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[multiply](multiply.md),
|
|
[sqrt](sqrt.md)
|