UNPKG

1.24 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function log
4
5Calculate the logarithm of a value.
6
7For matrices, the function is evaluated element wise.
8
9
10## Syntax
11
12```js
13math.log(x)
14math.log(x, base)
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`x` | number &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix | Value for which to calculate the logarithm.
22`base` | number &#124; BigNumber &#124; Complex | Optional base for the logarithm. If not provided, the natural logarithm of `x` is calculated. Default value: e.
23
24### Returns
25
26Type | Description
27---- | -----------
28number &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix | Returns the logarithm of `x`
29
30
31## Examples
32
33```js
34math.log(3.5) // returns 1.252762968495368
35math.exp(math.log(2.4)) // returns 2.4
36
37math.pow(10, 4) // returns 10000
38math.log(10000, 10) // returns 4
39math.log(10000) / math.log(10) // returns 4
40
41math.log(1024, 2) // returns 10
42math.pow(2, 10) // returns 1024
43```
44
45
46## See also
47
48[exp](exp.md),
49[log2](log2.md),
50[log10](log10.md),
51[log1p](log1p.md)