Posts

Showing posts with the label logarithm

log calculator

Image
My son has written a program to calculate the logarithm using any base. Be careful of splinters! The log base of For more stuff about logarithms see my posts: log base 2 and double, double toil and trouble . And of course, don't forget Wikipedia .

log base 2

Image
It turns out that the number 1 reason people visit this blog is to calculate log base 2 of an integer. So here is log 2 of 1 through 10, to 16 digits precision: log 2 (1) = 0 log 2 (2) = 1 log 2 (3) = 1.584962500721156 log 2 (4) = 2 log 2 (5) = 2.321928094887362 log 2 (6) = 2.584962500721156 log 2 (7) = 2.807354922057604 log 2 (8) = 3 log 2 (9) = 3.169925001442312 log 2 (10) = 3.321928094887362 Note that log 2 ( x ) is defined for any x greater than zero. If you have a calculator than computes the natural logarithm (often denoted ln), then you can calculate log 2 ( x ) = ln( x )/ln( 2 ). The same thing works with log base 10, i.e. log 2 ( x ) = log 10 ( x )/log 10 ( 2 ). But what does it mean ? log 2 ( x ) means the power you have to raise 2 in order to get x . For example, 2 2 = 4, so log 2 (4) is 2. Similarly, 2 3 = 8, so log 2 (8) = 3. It turns out that 2 1.58496 is very nearly 3, so log 2 (3) is roughly 1.58496. Some cases deserve special mention. log 2 (2) = 1 because 2 1 is...