55 lines
1.2 KiB
Markdown
55 lines
1.2 KiB
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
# Function log1p
|
|
|
|
Calculate the logarithm of a `value+1`.
|
|
|
|
For matrices, the function is evaluated element wise.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.log1p(x)
|
|
math.log1p(x, base)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | number | BigNumber | Complex | Array | Matrix | Value for which to calculate the logarithm of `x+1`.
|
|
`base` | number | BigNumber | Complex | Optional base for the logarithm. If not provided, the natural logarithm of `x+1` is calculated. Default value: e.
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | BigNumber | Complex | Array | Matrix | Returns the logarithm of `x+1`
|
|
|
|
|
|
### Throws
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.log1p(2.5) // returns 1.252762968495368
|
|
math.exp(math.log1p(1.4)) // returns 2.4
|
|
|
|
math.pow(10, 4) // returns 10000
|
|
math.log1p(9999, 10) // returns 4
|
|
math.log1p(9999) / math.log(10) // returns 4
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[exp](exp.md),
|
|
[log](log.md),
|
|
[log2](log2.md),
|
|
[log10](log10.md)
|