Number Bases: Introduction & Binary Numbers
4 stars based on
That is, for any real number x. The binary logarithm is the logarithm to the base 2. The binary logarithm function is the binary base function of the power of two function. Historically, the first application of binary logarithms was in music theoryby Leonhard Euler: Binary logarithms can be used to calculate the length of the representation of a number in the binary numeral systemor binary base number of bits needed to encode a message in information theory.
In computer sciencethey count the number of steps needed for binary search and related algorithms. Other areas in which the binary logarithm is frequently used include combinatoricsbioinformaticsthe design of sports tournamentsand photography. Binary logarithms are included in the standard C mathematical functions binary base other mathematical software packages. The binary base part of a binary logarithm can be found using the find first set operation on an integer value, or by looking up the exponent of a floating point value.
The fractional part of the logarithm can be calculated efficiently. The powers of two have been known binary base antiquity; for instance they appear in Euclid's ElementsProps. And the binary logarithm of a power of two is just its position in the ordered sequence of powers of two. On this basis, Michael Stifel has been credited with publishing the first known table of binary logarithms binary base His book Arithmetica Integra contains several tables that show the integers with their corresponding powers of two.
Reversing the rows of these tables allow them to binary base interpreted as tables of binary logarithms. Earlier than Stifel, the 8th century Jain mathematician Virasena is credited with a precursor to the binary logarithm. Virasena's concept of ardhacheda has been defined as the binary base of times a given number can be divided evenly by two.
This definition gives rise to a function that coincides with the binary logarithm on the powers of two,  but it is different for other integers, giving the 2-adic order rather than the logarithm. The modern form of a binary logarithm, applying to any number not just powers of two was considered explicitly by Leonhard Euler in Euler established the application of binary logarithms to music theory, long before their more significant applications in information theory and computer science became known.
As part of his work in this area, Euler binary base a table of binary logarithms of the integers from 1 to 8, to seven decimal digits binary base accuracy. The binary logarithm function may be defined as the inverse function to the power of two function, which is a strictly increasing function over the positive real numbers and therefore has a unique inverse.
Using binary base complex logarithm in this definition allows the binary logarithm to be extended to the complex numbers. As with other logarithms, the binary logarithm obeys the following equations, which can be used binary base simplify formulas that binary base binary logarithms with multiplication or binary base For more, binary base list of logarithmic identities.
Some authors write the binary logarithm as lg n  the notation listed in The Chicago Manual of Style. According to these standards, lg n should not be used for the binary logarithm, as it is instead reserved binary base the common logarithm log 10 n. In information theory, the definition of binary base amount of binary base and information entropy is often expressed with the binary logarithm, corresponding to making the bit the fundamental unit of information.
However, the natural logarithm and the nat are also used in alternative notations for these definitions. Although the natural logarithm is more important than the binary logarithm in many areas of pure mathematics such as number theory and mathematical analysis the binary logarithm has several applications in combinatorics:. The binary logarithm also frequently appears in the analysis of algorithms not only because of the frequent use of binary base number arithmetic in algorithms, but also because binary logarithms occur in the analysis of algorithms based on two-way branching.
This idea is used in the analysis of several algorithms and data structures. The running time of an algorithm is usually expressed in big O notationwhich is used to simplify expressions by omitting their constant factors and lower-order terms. The base binary base the logarithm in expressions such as O log n or O n log n is therefore not important and can be omitted. In bioinformatics binary base, microarrays are used to measure how strongly different genes are expressed in a sample of biological material.
Different rates of expression of a gene are often compared by using the binary logarithm of the ratio of expression rates: Binary logarithms allow for a convenient comparison of expression rates: Data points obtained in this way are often visualized as a scatterplot in which one or both of the coordinate axes are binary logarithms of intensity ratios, or in visualizations such as the MA plot and RA plot that rotate and scale these log ratio scatterplots.
In music theory binary base, the interval or perceptual difference between two tones binary base determined by the ratio of their frequencies.
Intervals coming from rational number ratios with small numerators and denominators are perceived as particularly euphonious. The simplest and most important of these intervals is the octavebinary base frequency ratio of 2: The number of octaves by which two tones differ is the binary logarithm of their binary base ratio. To study tuning systems and other aspects of music theory that require finer distinctions between tones, it is helpful to have a measure of the size of an interval that is finer than an octave and is additive binary base logarithms are rather than multiplicative as frequency ratios are.
That is, if tones xyand z form a rising sequence of tones, then the measure of the interval from x to y plus the measure of the interval from y binary base z should equal the measure of the interval from x to z. Such a measure is given by the centwhich divides the octave into equal intervals 12 semitones of binary base each. Mathematically, given tones with frequencies f 1 and f 2the number of cents in the interval from f 1 to f 2 is .
The millioctave is defined in the same way, but with a multiplier of instead of In competitive games and sports involving two players or teams in each game or match, the binary logarithm indicates the number of rounds necessary in a single-elimination tournament required to determine a winner.
The same number of rounds is also necessary to determine a clear winner in a Swiss-system tournament. In photographyexposure values are measured in terms of the binary logarithm of the amount of light reaching the film or sensor, in accordance with the Weber—Fechner law describing a logarithmic response of the human visual system to light. A single stop of exposure is binary base unit on a base- 2 logarithmic scale.
Binary logarithms expressed as stops are also used in densitometryto express the dynamic range of light-sensitive materials or digital sensors. The specific change of logarithm base formulae for this are: Binary base binary logarithm can be made into a function from integers and to integers by rounding it up or down.
These two forms of integer binary logarithm are related by this formula:. Extended in this way, this function is related to the number of leading zeros of the bit unsigned binary representation of xnlz x.
The integer binary logarithm can be interpreted as the zero-based index of the most significant 1 bit in the input. In this sense it is the complement of the find first set binary base, which finds the index of the least significant 1 bit. Many hardware platforms include support for finding the number of leading zeros, or equivalent operations, which can be used to quickly find the binary logarithm.
The fls and flsl functions in the Linux kernel  and in some versions of the libc software library also compute the binary logarithm rounded up to an integer, plus one.
For a general positive real numberthe binary logarithm may be computed in two parts. This reduces the problem to one where the argument of the logarithm is in a restricted range, the interval [1,2simplifying the second step of computing the fractional part the mantissa of the logarithm.
For normalized floating point numbers, the integer part is given by the floating binary base exponent,  and for integers it can be determined by performing a count leading zeros operation. In the special case where the fractional part in step 1 is found to be zero, this is a finite sequence terminating at some point.
For practical use, this infinite series must be truncated to reach an approximate result. The log2 function is included in the standard C mathematical functions. The default version of this function takes double precision arguments but variants of it allow the argument to be single-precision or to be a long double.
From Wikipedia, the free encyclopedia. Holt, Rinehart and Winston, p. A copy of the same table with two more entries appears on p. Non-European Roots of Mathematics 3rd ed. De Variorum Intervallorum Receptis Appelationibus", Tentamen novae theoriae musicae ex certissismis harmoniae principiis dilucide expositae in LatinSaint Petersburg Academy, pp.
The same notation was in the 2nd binary base of the same book p. Halbleiter-Schaltungstechnik binary base German 1st corrected reprint, 11th ed. Origins and Foundations of Computing: Design and ImplementationSpringer-Verlag, pp.