More advanced graph-plotting

Manipulation of equations

Sometimes, if you know the equation connecting two variables, it is possible to tinker with the variables, so as to give a straight line graph.

Suppose, for example, that two variables p and q are connected by the equation p = a q2+ b, where a is a constant. A graph of p against q would be a parabola, symmetrical about the p-axis and crossing the p-axis b above the origin. But if you plot p against q2, you get a straight line of gradient a. Another way of thinking about this is to make a new column in the table in which you record q2, but head the column s, and then plot p against s. Your graph will be a line of gradient a  and it will cut the p-axis at b. (Well, it won't actually cut the p-axis, as there won't be any negative values of s!)

Now suppose that two variables f and g are connected by f g = k, where k is a constant. This time, the ordinary plot gives a hyperbola approaching both axes asymptotically. But if you re-cast the equation as f = k / g, re-write 1/g as h, and then plot f against h, you get a straight line of gradient k.

Last, for the purposes of this note, suppose the equation is f (g + a) = k, where a and k are both constants. This is a bit trickier, because the variable g and the (as yet unknown) constant a are mixed up together. You have to re-cast the equation as (g + a) = k / f, and replace 1 / f with h, so that the equation becomes g = k h - a. Then you plot g against h to obtain a straight line of gradient k and g-intercept -a.

Properties of logs

The fundamental property of logs is that if you want to multiply two numbers a and b together, you can add their logs instead, so that

log ab = log a + log b

A particular case of interest is this:

log a5 = log (aaaaa) = log a + log a + log a + log a + log a = 5 log a

which may be generalised to 

log am = m log a

Note that in all of the above, it does not matter to which base one takes the logs. In graphical work log10 is usual.

Power laws

Consider the equation for kinetic energy 

E = ½ m v2

or Newton's Law of Gravitation

F = G M m / r 2 = G M m r -2

Both of these laws have the general form 

Y = C X k

where C is a constant (or collection of constants multiplied together, which is the same thing), k is the power to which one variable (X) is raised, and Y is the other variable.

Now take logs of both sides and use the log rules outlined in the first paragraph.

log Y = log (C X k)= log C + log X k = log C + k log X

If we now write y instead of log Y, x instead of log X and c instead of log C, we obtain

y = k x + c

which we recognise at once as the equation of a straight line of gradient k and y-intercept c.

Uncovering power laws

If you suspect that two variables are connected with a power law of the general form given above, then the trick is to find the logs of the two variables - make two new columns in your table - and plot a graph of these two newly generated quantities. If you get a straight line, then you find the gradient in the ordinary way and this will be the value of k. Then you look for the y-intercept. This is log C, and you have to find its antilog to get at the value of C itself. (You do this with the [inv] [log] keys or with the [10x] key.)

It is possible to bypass the process of making two new columns in the table by plotting the results onto log-log graph paper. Numbering the scales on this is a bit tricky (see box below). Finding the gradient is odd, too, in that you use the actual height and base of your gradient triangle rather than the scaled height and base. The value of C is just read off the vertical scale, without needing to go through the antilogging process.

To number a logarithmic scale, notice first that the scale ticks get gradually closer together, and then they quite suddenly open out again and the pattern repeats itself. The main ticks along one pattern are numbered, say, 1, 2, 3,...,9 and then the new cycle begins with 10, 20, 30, ....., 90, and the next cycle 100, 200,... etc. Of course you might want to start the first cycle with 0.001, 0.002, ..... 0.009 and continue the second cycle with 0.01, 0.02,... etc. If you use paper that I have prepared, you may find that there are very small numbers 1, 2, 3 ... etc to help with this. Notice in particular that there is no zero on a logarithmic scale. People often have difficulty at first placing the number 12, and they erroneously put it on 20 - take care with this.

Exponential relationships

Consider the radioactive decay law

A = A0 e -l t

If we take natural logs of both sides, we obtain

ln A     =    ln (A0 e -l t)     =     ln A0 + ln e -l t     =     ln A0 - l t ln e    =     ln A0 - l t 

If we re-write this, substituting y for ln A and c for the constant ln A0, we obtain

y = - l t + c

which we recognise as a straight line of gradient  - and y-intercept c.

Uncovering exponential relationships

If you suspect an exponential relationship, form one extra column in which you put the log of the appropriate variable. Then plot the other variable against this log. If you obtain a straight line then you know that you have an exponential without needing to test for a half life in the traditional way.

The method works with log10 or with natural logs. There exists log-lin graph paper, which enables you to plot the graph directly. See the box above for hints on numbering the logarithmic axis. Because the logarithmic axis is always to base 10 rather than base e, but the theory uses base e, you do have to keep a very clear head when interpreting the gradient and y-intercept. If you are good enough to be able to cope with this, you don't need any notes here to help you!

Return

Tony Ayres, May 2001