1 |
|
2 |
|
3 | # Function log1p
|
4 |
|
5 | Calculate the logarithm of a `value+1`.
|
6 |
|
7 | For matrices, the function is evaluated element wise.
|
8 |
|
9 |
|
10 | ## Syntax
|
11 |
|
12 | ```js
|
13 | math.log1p(x)
|
14 | math.log1p(x, base)
|
15 | ```
|
16 |
|
17 | ### Parameters
|
18 |
|
19 | Parameter | Type | Description
|
20 | --------- | ---- | -----------
|
21 | `x` | number | BigNumber | Complex | Array | Matrix | Value for which to calculate the logarithm of `x+1`.
|
22 | `base` | number | BigNumber | Complex | Optional base for the logarithm. If not provided, the natural logarithm of `x+1` is calculated. Default value: e.
|
23 |
|
24 | ### Returns
|
25 |
|
26 | Type | Description
|
27 | ---- | -----------
|
28 | number | BigNumber | Complex | Array | Matrix | Returns the logarithm of `x+1`
|
29 |
|
30 |
|
31 | ## Examples
|
32 |
|
33 | ```js
|
34 | math.log1p(2.5) // returns 1.252762968495368
|
35 | math.exp(math.log1p(1.4)) // returns 2.4
|
36 |
|
37 | math.pow(10, 4) // returns 10000
|
38 | math.log1p(9999, 10) // returns 4
|
39 | math.log1p(9999) / math.log(10) // returns 4
|
40 | ```
|
41 |
|
42 |
|
43 | ## See also
|
44 |
|
45 | [exp](exp.md),
|
46 | [log](log.md),
|
47 | [log2](log2.md),
|
48 | [log10](log10.md)
|