What is it?
The inverse of the exponential: is the power you raise to in order to get . Logarithms turn products into sums, which is why they appear in algorithm costs, information theory and every loss function based on likelihood.
Intuition
counts how many times you can halve before reaching 1 — the number of steps of binary search, the depth of a balanced tree, the number of bits needed to write .
Formulas
- products of probabilities become sums
Where it shows up in computing
Binary search is and comparison sorting .
Multiplying many small probabilities underflows to 0; summing their logs (log-sum-exp) does not.
Where it shows up in AI
Cross-entropy is a negative log-likelihood; the log turns a product over samples into a sum.
Where is it used?
Computing topics reachable from here, through the chain of ideas that leads to them:
λ Scientific computing and algorithms
- Algorithm analysis and complexity★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Symbolic computation (CAS)★★★★★
- Orders of growth→Asymptotic notation (O, o, Ω, Θ)→Order of convergence→Scientific computing★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Fundamental theorem of calculus→Cumulative distribution function→Monte Carlo methods★★★★★
- Floating point (IEEE 754)★★★★★
⚙ Robotics and control
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Control theory★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Control theory→Trajectory optimization and MPC★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Laplace transform→PID control★★★★★
⚛ Physics and simulation
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Classical mechanics★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Physics engines★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Population and epidemic models★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Integration by parts→Finite element method★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Physics engines→N-body gravitational simulation★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Partial differential equations→Heat equation and diffusion★★★★★
- +2
∿ Signals, media and vision
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Partial fractions→Digital filters★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Integration by substitution→Trigonometric integrals→Signal processing★★★★★
- Derivatives of elementary functions→Antiderivatives and indefinite integrals→Ordinary differential equations→Partial differential equations→Image processing and computer vision★★★★★
What depends on it
Exercises
Why do ML libraries compute as with ?
Solution
Both are equal since . But overflows a double, while every and at least one equals 1, so the sum is in and safe.