Documentation moved.
This entry is documented with its primary interface. Open the documentation →
Function
src/index.ts:907nerdamer.log
nerdamer.log(x: ExpressionInput, base?: ExpressionInput, expandPrimes: boolean): ExpressionComputes the natural (base-e) logarithm, or optionally a logarithm with a specified base.
When Settings.EVALUATE is false, real-domain logarithm identities are
applied only when their arguments are provably positive real values. This
keeps product, quotient, and power rewrites from crossing principal complex
branches when a symbolic sign is unknown.
For known negative real inputs, returns log(|x|) + iπ. Complex inputs use the
principal branch: log(z) = log|z| + i·arg(z).
throws
core!UndefinedError If x is -∞.
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | The expression to take the logarithm of. |
base | ExpressionInput | Optional logarithm base. Defaults to e (natural log). |
expandPrimes | boolean | When true, decomposes integer arguments into prime factors
(e.g. log(8) becomes 3·log(2)). Defaults to false. |
Returns
Expression — The logarithm of x.
Examples
log('e').text() // "1"
log(1).text() // "0"
log('e^x').text() // "x"
// With base
log(8, 2).text() // "3"