Function log

Calculate the logarithm of a value.

For matrices, the function is evaluated element wise.

Syntax

log(x)
log(x, base)

Parameters

Parameter Type Description
x number | BigNumber | Complex | Array | Matrix Value for which to calculate the logarithm.
base number | BigNumber | Complex Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e.

Returns

Type Description
number | BigNumber | Complex | Array | Matrix Returns the logarithm of x

Examples

log(3.5);                  // returns 1.252762968495368
exp(log(2.4));        // returns 2.4

pow(10, 4);                // returns 10000
log(10000, 10);            // returns 4
log(10000) / log(10); // returns 4

log(1024, 2);              // returns 10
pow(2, 10);                // returns 1024

See also

exp, log10