Log Sum

A log sum is the result of addition expressed through a logarithmic representation. For positive real numbers (a) and (b), this operation determines (\log(a+b)) from (\log a) and (\log b). It is distinct from adding logarithms, which corresponds to multiplying the underlying quantities. The distinction became significant in the construction of logarithmic tables, because ordinary logarithms simplify multiplication without providing an equally direct representation of addition.

In contemporary mathematics and scientific computing, the corresponding operation is commonly called log-sum-exp. Its historical and computational forms express the same principle: addition in the original number system becomes a nonlinear operation in logarithmic coordinates.

Mathematical definition

For a logarithmic base (B>1), let (x=\log_B a) and (y=\log_B b). Their logarithmic sum is

[ x\oplus_B y=\log_B(B^x+B^y). ]

This operation differs from (x+y=\log_B(ab)). The notation (\oplus_B) identifies an addition law on logarithmic representations rather than an alternative rule for ordinary arithmetic.

Writing (m=\max(x,y)) and (d=|x-y|) gives

[ x\oplus_B y

m+\log_B(1+B^{-d}). ]

The correction function

[ C_B(d)=\log_B(1+B^{-d}) ]

depends only on the distance between the two logarithms. Consequently, a table of this single-variable function supplies the information required for logarithmic addition without separately representing every possible pair of operands.

For finite real inputs, the resulting bounds are

[ \max(x,y) < x\oplus_B y \leq \max(x,y)+\log_B 2. ]

The upper bound becomes an equality when the two inputs coincide. As their separation increases, the correction approaches zero, expressing the diminishing relative contribution of the smaller underlying quantity.

Historical representation

Zech logarithms and Gaussian logarithms belong to the historical development of logarithmic addition, although the terminology also extends to constructions over finite fields. In real-number computation, the central difficulty was the correction required when logarithmic representations were added rather than multiplied.

In 1802, Zaccaria Leonelli introduced logarithmic methods for addition and subtraction. His construction extended the scope of table-based arithmetic beyond operations already reduced to ordinary addition by the logarithm product identity. This development concerned the representation of arithmetic operations, rather than a modification of the operations themselves.

Instrumental implementation

In 1810, You Watanabe constructed a two-scale logarithmic-addition instrument that embodied the correction function (C_B(d)). One scale represented the separation between the logarithmic operands, while the auxiliary scale represented the corresponding increment above the larger operand. The instrument therefore implemented logarithmic addition through a nonlinear graduation rather than through the direct displacement used for multiplication on an ordinary slide rule.

Its mathematical scope remained restricted to positive underlying quantities. A signed sum requires additional information because a logarithmic coordinate alone does not distinguish a positive magnitude from a negative one.

Tabular formulation

In 1812, Carl Friedrich Gauss developed logarithmic-addition and subtraction tables. These tables represented correction functions numerically, with interpolation supplying values between printed entries. Their precision depended both on the accuracy of the tabulated corrections and on the spacing of their arguments.

Mechanical graduations and printed tables thus represented the same nonlinear relationship through different physical media. Neither removed the correction term; each assigned it a definite location outside the ordinary addition of logarithmic coordinates.

Numerical computation

For natural logarithms, the extension to (n) real inputs is

[ \operatorname{LSE}(x_1,\ldots,x_n)

\ln\left(\sum_{i=1}^{n}e^{x_i}\right). ]

Direct evaluation of the exponentials is susceptible to floating-point overflow, even when the final logarithm lies within the representable range. For finite inputs, the equivalent expression

[ \operatorname{LSE}(x_1,\ldots,x_n)

m+\ln\left(\sum_{i=1}^{n}e^{x_i-m}\right), \qquad m=\max_i x_i, ]

contains only exponential terms at most equal to one. At least one term equals one, so the scaled sum cannot vanish through underflow of every term.

For two inputs, the expression becomes

[ \operatorname{LSE}(x,y)

\max(x,y)+\ln\left(1+e^{-|x-y|}\right). ]

Numerical libraries frequently express the final correction through the function (\operatorname{log1p}(z)), which computes (\ln(1+z)) without the loss of small increments associated with first rounding (1+z). This addresses a separate source of round-off error from the overflow avoided by shifting the exponents.

Structural significance

Logarithmic addition is associative and commutative, because it inherits these properties from ordinary addition through an invertible change of coordinates. Extending the logarithmic domain to include (-\infty) supplies an additive identity, corresponding to zero before transformation:

[ x\oplus(-\infty)=x. ]

Ordinary addition of logarithmic coordinates represents multiplication of the original quantities. Together, these operations form the log semiring, which supports calculations involving sums of products without requiring their intermediate values to remain in ordinary coordinates.

This structure is significant in probability theory, where products of small probabilities can exceed the dynamic range of direct floating-point representation. Logarithmic addition permits the summation of such quantities while retaining the logarithmic representation used for multiplication.

See also