Link to home
Start Free TrialLog in
Avatar of vimalalex
vimalalex

asked on

Logarithm

Hi experts,
                    What is the application of logarithm and where to use it and give an example of a problem which we can solve using basic arithmatic(addition,mul,sub,etc...) and solving same problem using logarithm.I am not too skill in maths.Please help me with a good example for logarithm.

Regards,
Vimal.
Avatar of Martin_J_Parker
Martin_J_Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

I'm not sure that a problem which is solved with logs is also going to be solved with simple arithmetic.

It's not quite what you are after, but a great example of logarithms is in the news right now - earthquakes are measured on a log scale.

Although the official measurement of quakes is done on the Moment magnitude Scale, ( http://en.wikipedia.org/wiki/Moment_magnitude_scale ), the media still like to report using the old Richter magnitude scale ( http://en.wikipedia.org/wiki/Richter_magnitude_scale ) - probably because more people have heard of it.

The energy released by an earthquake, which closely correlates to its destructive power, scales with the power of 1.5 of the shaking amplitude. A difference in magnitude of 1.0 is equivalent to a factor of 31.6 in the energy released; a difference in magnitude of 2.0 is equivalent to a factor of 1000 in the energy released.

So the difference between the 8.9 size quake in Japan and the recent 6.3 size quake in New Zealand is 8.9-6.3=2.6, so the difference in destructive power is (inverse log 2.6) to the power of 1.5 - which gives an answer of nearly 8000x the destructive force in the recent Japan quake!

By the way, inverse log of x = 10 to the power of x.
Avatar of TommySzalapski
Let's say you have a tournament (with lots of teams) and you want to find out how many rounds there have to be. Each round removes half the group, so you could divide the number by 2 over and over until you get to <1 and count the divisions, or you could just use log. (Log base 2 of course).
Example:
65536 teams
/2 = 32768
/2 = 16384
/2 = 8192
/2 = 4096
/2 = 2048
/2 = 1024
/2 = 512
/2 = 256
/2 = 128
/2 = 64
/2 = 32
/2 = 16
/2 = 8
/2 = 4
/2 = 2
/2 = 1

=16 rounds
log2(65536) = 16. Done!
If you don't have log2 you can use ln(x)/ln(2)
ln(65536)/ln(2) = 16
Hi,

as mentioned shortly above, logarithms can play role wherever exponential functions are used.

It's application could be useful when solving some population-related problems.

Consider a single-cell organism, which replicates itself every minute. To solve the question of how many cells will there be after t = 100 minutes you can use following formula: 2^t = 2^100.

To solve an inverse problem: determine the time needed to reaching the number of 1.000.000 cells. Here's where the logarithm will be the way to go:

2^t = 1.000.000 where the variable t is unknown. following formula solves this: t = log2(1.000.000) = ln(1.000.000)/ln(2)
As an example of the use of logarithms, take a look at a slide ruler.  By having bars in logarithmic scales, you can multiply by adding.  That is, adding logarithms together can give you the product of the original numbers.
Avatar of vimalalex
vimalalex

ASKER

Hi All,
                I am a C++ programmer we have direct functions in c++ for finding logarithms. From the above comments I understand that when ever we are dealing with exponential  operations we can use logarithm. But I think we have solve the exponential  operations with out log also.For example    
as TommySzalapski's example we can solve the same problem by doing LCM. I want to know the complexity of the TommySzalapski's example or the other examples mentioned above all comments which will take less time for do the job. How internally logarithm solves this problems what type of algorithm they are using. Since I am a programmer while designing a program i need to choose a less complexity method.

Thanks & Regards,
Vimal.
Suppose you are dealing with audio frequencies and you want to jump up one octave.  That is an easy matter of just doubling the frequency.  Suppose instead that you want to write a function that allows you to jump up an arbitrary number of octaves, not necessarily integral.  Logarithms will make that much easier.
Well, log base 2 can be computed in O(lg(lg(n))) time (which is rediculously fast, it takes 5 instruction sets to compute for numbers in the 4000000000 range).

Wikipedia has one version (you can make it a bit faster by hard coding more).
http://en.wikipedia.org/wiki/Binary_logarithm

Since logs can be converted easily (log10(x) = log2(x)/log2(10)) then you can do any logarithm by using log 2 and then dividing by a constant. So all logarithms have a complexity of O(lg(lg(n))).
Hi CompProbSolv,
                              Thanks for your precious reply.See in c++ by calling a single api log() we can achieve
the doubling the frequency or exponential operations but what my doubt is what is the internal concept of logarithm what type of maths operation they are using (+,-,/,*,etc). Why i am asking is in c++ application especially signal processing as you said performance is the main factor so before choosing a method we need to know its details. Now i am developing a software dealing with dsp. I think you can guide me for this doubt.

Thanks & regards,
Vimal
Did you see http:#a35167966? It details how the log can be computed (it's very very efficient). The wikipedia article shows how it can be calculated for integers. For floats (which are stored as a mantissa and exponent) the log base 2 is basically there already. (The exponent is the log base 2 rounded down, and the mantissa gives the rest). So for floats and doubles, it's O(1).
ASKER CERTIFIED SOLUTION
Avatar of CompProbSolv
CompProbSolv
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That should read 'rounded up' not 'rounded down'.
Hi TommySzalapski and CompProbSolv,

                  I am satisfied with both your comments. One more question in school days i have used a logarithm table now I forget every thing about logarithm table.Because I am remembering we were used log table for solving log based problems with out using scientific calculator.Is CPU using any log tables for solving logarithms.

thanks & Regards,
Vimal.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A log table just gives you the logs for a bunch of numbers. You just pick whichever one is closest to your number to get an approximation.
Hi TommySzalapski and CompProbSolv,
               
              You both has solved my doubt. Thanks Very much. I have some doubts in other maths topics I will post that by 2-3 days.

Thanks & regards,
Vimal.
Glad to help. I'll be watching for your next questions.