Function reference · Math

log

Returns the natural logarithm, or the logarithm in a given base.

With one argument the base is e; a second argument sets the base. Exact values are simplified.

For a complex number it is the principal logarithm. Rules such as log(x*y)=log(x)+log(y) are used only when the signs allow them, for example with assumptions.

Notation

log(arg1, [arg2])

Write it in an expression: nerdamer('log(e)'), or in the Playground.

nerdamer.log

nerdamer.log(x: ExpressionInput, base?: ExpressionInput, expandPrimes: boolean): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

The natural logarithm of e.

log(e)
// → 1
Open in Playground

Base 2.

log(8,2)
// → 3
Open in Playground

A symbolic argument.

log(x)
// → log(x)
Open in Playground

Logarithm and exponential cancel.

log(e^x)
// → x
Open in Playground

← Back to Function reference