log

log(x)

log(x, base)

Try it yourself:

See also:

log(): Natural Logarithm

log() returns the natural logarithm, the exponent to which e must be raised to obtain the input. It is fundamental in growth models, likelihoods, information theory, and reversing exponential processes.

Domain and scale

For real arithmetic, log(x) requires x > 0. log(1) is zero, and values between zero and one have negative logs. Use exp() to reverse it and log1p() for accurate log(1+x) when x is small.

For another base, use log10() or log2(). Normalize physical quantities before logarithms: their arguments should be positive and dimensionless.

All functions