A logarithm is the exponent to which a specified base must be raised to obtain a given number. A base-10 logarithm expresses a number’s position on a scale where equal intervals represent equal multiplication ratios rather than equal differences. section 12.1
In numerical analysis, logarithms support several related operations:
- Compute Benford probabilities with log10(1 + 1/d), where d ranges from 1 through 9; these probabilities sum to 1. section 12.1
- Separate a logarithm into its characteristic, the integer portion, and mantissa, the fractional portion. section 12.5.4
- Evaluate mantissas using mean, variance, excess kurtosis, and skewness when testing whether leading digits follow Benford’s law. section 12.5.4
Computing Benford probabilities
Using NumPy and pandas, calculate the expected leading-digit distribution with df1 = df1.assign(benford = round(np.log10(1 + (1 / df1.d)), 3)). The resulting probabilities are 0.301 for digit 1 and 0.046 for digit 9; their sum is 1.0. section 12.1
Extracting a mantissa
For a population value of 287,437, the base-10 logarithm is 5.458543: the characteristic is 5 and the mantissa is 0.458543. In Python, compute these parts with populations['log'] = np.log10(populations['Population']) and populations['mantissa'] = populations['log'] - populations['log'].astype(int). section 12.5.4
>>> import numpy as np >>> df1 = df1.assign(benford = round(np.log10(1 + (1 / df1.d)), 3)) >>> print(df1) d benford 0 1 0.301 1 2 0.176 2 3 0.125 3 4 0.097 4 5 0.079 5 6 0.067 6 7 0.058 7 8 0.051 8 9 0.046
Inspect the executable calculation of base-10 Benford probabilities for digits 1 through 9. section 12.1


