# The wonderful logarithm (or blog on log)

I’ve been marking a couple of student assignments today. I won’t go into the details, but as part of it they had to process some data and plot some graphs. The graphs showed values that varied considerably – some thousands of times bigger than others.  I had expected (assumed = bad move) that the students would use logarithms to show their data, but, regrettably, they didn’t, so I had to look at data points that I could barely distinguish above the axis.

Logarithms crop up a lot in physics as the inverse of the exponential, but they have a lot of neat uses as well. One, as I’ve said above, is in dealing with data that vary over a huge range. The logarithm, or ‘log’, for short, says – "to what power would I have to raise 10 to get the number concerned" – or, in mathematical terms, if y = log x, then 10^y = x. So, the log of 1 is 0, the log of 10 is 1, the log of 100 is 2, and the log of 1000000000000 is a mere 12. So we can put large and small numbers on the same graph.

For example, this semester I’ve been taking a third-year class on electromagnetic waves. These include radio, X-ray, visible light, microwaves etc. These wave phenomena can all be assigned a wavelength, and it turns out that there is a ferocious range of wavelengths that get used in physics. At one end of the spectrum (literally) there are radio waves, which could have wavelengths kilometres long, at the other there are gamma rays, which can have wavelengths of order ten to the power of minus twelve metres or shorter (that’s 0.000 000 001 millimetres). To show a nice picture with these on you have to use a logarithmic scale. If you take logs of the wavelength, your axis only has to go from about -12 or so through to about 3.  Much more manageable.

Logs are also useful at finding relationships between quantities that you measure experimentally. Suppose you have two quantities, X and Y. You vary X, and measure Y. How does Y depend on X? A good suggestion is to plot a graph of the logarithm of Y against the logarithm of X. If Y is related to X by a power law, that is, Y  is proportional to X to the power N, then a plot of log Y against log X should be a straight line of gradient N. So we can find N.  Of course, not all relationships are power-law relationships, but in physics a lot are.

A third, and somewhat dubious use, is to hide problems with your data.  Taking logs tends to make data points look ‘closer’ to each other than they actually are – so a noisy graph looks a lot smoother when you take logs.

As I final topical example of logs, I’ll mention the earthquake local magnitude scale. Since earthquakes vary tremendously in energy, a good scale to use is a logarithmic scale. The scale is logarithmic in that an increase of 1.0 means that the amplitude of vibration has increased ten times. In terms of energy, however, an increase in magnitude of 1.0 denotes an increase of 30 times the energy release. So a magnitude 6.0 is thirty times more ‘powerful’ than one of magnitude 5.0.   Here, the number after the decimal point really does make a difference. So the Canterbury earthquakes (7.1, 6.3) are really small-fry compared to the Sendai earthquake (9.0).