mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
62 lines
1.6 KiB
Markdown
62 lines
1.6 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-exp">Function exp <a href="#function-exp" title="Permalink">#</a></h1>
|
|
|
|
Calculate the exponential of a value.
|
|
For matrices, if you want the matrix exponential of square matrix, use
|
|
the `expm` function; if you want to take the exponential of each element,
|
|
see the examples.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.exp(x)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | number | BigNumber | Complex | A number to exponentiate
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | BigNumber | Complex | Exponential of `x`
|
|
|
|
|
|
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
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.map([1, 2, 3], math.exp)
|
|
// returns Array [
|
|
// 2.718281828459045,
|
|
// 7.3890560989306495,
|
|
// 20.085536923187668
|
|
// ]
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[expm1](expm1.html),
|
|
[expm](expm.html),
|
|
[log](log.html),
|
|
[pow](pow.html)
|