mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
46 lines
994 B
Markdown
46 lines
994 B
Markdown
# Function exp
|
|
|
|
Calculate the exponent of a value. For matrices, the function is evaluated element wise.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.exp(x)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | Number | Boolean | Complex | Array | Matrix | A number or matrix for which to calculate the exponent
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Number | Complex | Array | Matrix | Exponent of `x`
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
var math = mathjs();
|
|
|
|
math.exp(2); // returns Number 7.3890560989306495
|
|
math.pow(math.e, 2); // returns Number 7.3890560989306495
|
|
math.log(math.exp(2)); // returns Number 2
|
|
|
|
math.exp([1, 2, 3]); // returns Array [
|
|
// 2.718281828459045,
|
|
// 7.3890560989306495,
|
|
// 20.085536923187668
|
|
// ]
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[pow](pow.md),
|
|
[log](log.md)
|