Jump to content

Common logarithm: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 17: Line 17:
The bar over the characteristic indicates that it is negative whilst the mantissa remains positive. Negative logarithm values were rarely converted to a normal negative number (−0.920819 in the example).
The bar over the characteristic indicates that it is negative whilst the mantissa remains positive. Negative logarithm values were rarely converted to a normal negative number (−0.920819 in the example).


{| class="wikitable" style="text-align:center;" border="1"
{| class="wikitable" style="text-align:center;" border="1" cellpadding=5px
!number
!number
!log10(''n'')
!log10(''n'')
!characteristic
!characteristic
!mantissa
!mantissa
!combined form
!characteristic
|-
|-
!''n''
!''n''
Line 28: Line 28:
!floor(log10(''n''))
!floor(log10(''n''))
!log10(''n'') - characteristic
!log10(''n'') - characteristic
!
! . mantissa
|-
|-
|500000
|500000

Revision as of 17:46, 21 October 2009

The common logarithm.

The common logarithm is the logarithm with base 10. It is also known as the decadic logarithm, named after its base. It is indicated by log10(x), or sometimes Log(x) with a capital L (however, this notation is ambiguous since it can also mean the complex natural logarithmic multi-valued function). On calculators it is usually "log", but mathematicians usually mean natural logarithm rather than common logarithm when they write "log".

Before the early 1970s, hand-held electronic calculators were not yet in widespread use. Because of their utility in saving work in laborious calculations by hand on paper, tables of base 10 logarithms were found in appendices of many books. Such a table of "common logarithms" giving the logarithm of each number in the left-hand column, which ran from 1 to 10 by small increments, perhaps 0.01 or 0.001. There was only a need to include numbers between 1 and 10, since if one wanted the logarithm of, for example, 120, one would know that

The very last number ( 0.079181)—the fractional part of the logarithm of 120, known as the mantissa of the common logarithm of 120—was found in the table. (This stems from an older, non-numerical, meaning of the word mantissa: a minor addition or supplement, e.g. to a text. For a more modern use of the word mantissa, see significand.) The location of the decimal point in 120 tells us that the integer part of the common logarithm of 120, called the characteristic of the common logarithm of 120, is 2.

Similarly, for numbers less than 1 we have

The bar over the characteristic indicates that it is negative whilst the mantissa remains positive. Negative logarithm values were rarely converted to a normal negative number (−0.920819 in the example).

number log10(n) characteristic mantissa combined form
n floor(log10(n)) log10(n) - characteristic
500000 5.698970004336018... 5 0.698970004336018... 5.698970004336018...
50 1.698970004336018... 1 0.698970004336018... 1.698970004336018...
5 0.698970004336018... 0 0.698970004336018... 0.698970004336018...
.5 −0.30102999566398... −1 0.698970004336018... 1.698970004336018...
.0000005 −6.30102999566398... −7 0.698970004336018... 7.698970004336018...


Numbers are placed on slide rule scales at distances proportional to the differences between their common logarithms. By mechanically adding the distance from 1 to 2 on the lower scale to the distance from 1 to 3 on the upper scale, one can quickly determine that 2 x 3 = 6.

In addition, slide rules work by using a logarithmic scale.

History

Common logarithms are sometimes also called Briggsian logarithms after Henry Briggs, a 17th-century British mathematician.

Because base 10 logarithms were most useful for computations, engineers generally wrote "log(x)" when they meant log10(x). Mathematicians, on the other hand, wrote "log(x)" when they mean loge(x) for the natural logarithm. Today, both notations are found. Since hand-held electronic calculators are designed by engineers rather than mathematicians, it became customary that they follow engineers' notation. So ironically, that notation, according to which one writes "ln(x)" when the natural logarithm is intended, may have been further popularized by the very invention that made the use of "common logarithms" far less common, electronic calculators.

Uses

Plotting data

The characteristic and mantissa of a logarithm provide a simple and convenient way to automatically determine "nice" values for annotating a graph's linear scale plotting numeric data. The scale will have a span that begins with a value less than or equal to the minimum datum and stops with a value greater than or equal to the maximum datum and using suitable increments. The number of increments used to enumerate the scale will range from 6 to 11 (including the ends).

The relative magnitude of the range of data to be displayed is determined by the mantissa of log10(maximum − minimum). The mantissa will be a portion of a decade. Portions less than 1/5 are enumerated with an increment of .2, otherwise if less than 1/2 by .5, otherwise by 1. The characteristic determines the power of 10 that the relative magnitude, and that of its consequent enumerating increment, must be multiplied by, to get the absolute values needed to enumerate the range.

function base10log(n){ with (Math) return log(n)/log(10) }

function getScale(minValue,maxValue) {
    with (Math) {
	cm = base10log(abs(maxValue-minValue));
	characteristic = floor(cm);	mantissa = cm-characteristic;		span = pow(10,mantissa);
	increment = ( span<=5 ? 1 : span<=2 ? 0.5 : 0.2 )  *  pow(10,characteristic);

	return	{
			start:	floor(minValue/increment)*increment,
			end:	ceil(maxValue/increment)*increment,
			stepBy:	increment
		}
    }
}

Numeric value

The numerical value for logarithm to the base 10 can be calculated with the following identity.

as procedures exist for determining the numerical value for logarithm base e and logarithm base 2.

Alternatively below is a correct but inefficient algorithm written in Python that can calculate the common logarithm to an arbitrary number of decimal places.[1]

#!/usr/bin/python
    
from __future__ import division
import math

# Calculates the logarithm (to any base > 1) of a positive number
# to an arbitrary number of decimal places.  The accuracy is
# subject only to limitation of the floating-point representation.
def log(X,base=math.e,decimalplace=12):
    integer_value=0
    while X < 1:
        integer_value -= 1 
        X = X * base
    while X >= base:
        integer_value += 1
        X /= base
    decimal_fraction = 0.0
    partial = 1.0
    # Replace X with X to the 10th power
    X **= 10
    while decimalplace > 0:
        partial /= 10
        digit=0
        while X >= base:
              digit += 1
              X /= base
        decimal_fraction += digit * partial
        # Replace X with X to the 10th power
        X **= 10
        decimalplace -= 1
    return integer_value + decimal_fraction

if __name__ == '__main__':
    value = 4.5
    print "                      X  =",value
    print " 6 decimal places LOG(X) =",log(value,base=10,decimalplace=6)
    print " 9 decimal places LOG(X) =",log(value,base=10,decimalplace=9)
    print "12 decimal places LOG(X) =",log(value,base=10,decimalplace=12)

# Sample Run
#
# $ python log.py
#                       X  = 4.5
#  6 decimal places LOG(X) = 0.653212
#  9 decimal places LOG(X) = 0.653212513
# 12 decimal places LOG(X) = 0.653212513775

See also

References

  • "Briggsian logarithms". PlanetMath. includes a detailed example of using logarithm tables