How to Calculate Logarithms to Base 2

Logarithms were invented to simplify calculations in the days before computers. It turned out that logarithms are also useful for describing natural phenomena such as radioactive decay. The original logarithms were base 10, defined as Log N = k when 10^k = N. Ten was chosen because it is a convenient base for doing calculations. With the invention of the computer, it became apparent that logs base two, defined as log N = k when 2^k = N, would be useful for describing many of the things that computers do.

Instructions

    • 1

      Use logarithms base two to describe the process known as a binary search. To find your IRS record, start by comparing the record in the middle of the list to your SSN. Using this information, look at the upper or lower half of the list -- starting in the middle of that section. Continue until the number is found. It will take no more than log-base-two N steps, where N is the size of the list. For a list with a million items, the search will take about 20 steps because log base two of 1,000,000 is approximately 20 -- 2^20 = 1,048,572.

    • 2

      Convert from logs base ten to logs base two using the fundamental laws of logarithms. Tables of logs base ten are readily available, we just need a formula to convert from logs base 10 to logs base 2. Suppose Log base 2 of N = k. From the definition of a logarithm, this means that 2^k = N. Taking the log base 10 of both sides, we get log base ten of 2^k = log base ten of N; k times log base ten of 2 = log base ten of N; k = (log base ten of N) / (log base ten of 2). But because k = log base two of N, we have log base two of N = (log base ten of N) / (log base ten of 2).

    • 3

      Compute logs base two from logs base ten by dividing by log base ten of 2, which is approximately 0,3010. So to convert logs base ten to logs base two, use the formula log base two N = log base ten of N/0.3010. It is easy to write a small computer program to convert the logs from base ten to logs base two.

Learnify Hub © www.0685.com All Rights Reserved