LabRefCh10 Power Law and Log

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

99

10. Power-Law Fitting and Log-Log Graphs

Chapter 10: POWER-LAW FITTING AND LOG-LOG


GRAPHS
She had taken up the idea, she supposed, and made everything bend to it.
--- Emma
10.1 DEALING WITH POWER LAWS

Although many relationships in nature are linear, some of the most interesting
relationships are not. Power-law dependences, of the form
y ( x) = kx n

(10.1)

are particularly common. In many cases, we might suspect that two experimental variables are
related by a power-law relationship, but are unsure of what k or n are. For example, we might
suspect that the period T of a simple harmonic oscillator might depend on the mass m of the
oscillating object in some kind of power-law relationship, but we might be unsure of exactly
what the values of either n or k. If we knew n, then we could plot y vs. xn to get a straight line;
the slope of that line would then be k. But if we dont know n, it would seem at first glance that
the best we could do would be simply try different possible values of n to see what works. This
could get old fast.
We can, however, take advantage of the properties of logarithms to convert any
relationship of the type given by equation 10.1 into a linear relationship, even if we do not know
either k or n! The most basic property of logarithms (for any base, but lets assume base-ten
logs) is that

log(ab) = log a + log b

10.2a)

From this it follows that


n times
n times
log a = log(a a K a ) = log a + log a + K + log a = n log a

( )
n

(10.2b)

(This is actually true even for non-integer n.) Also, in the case of base-ten logarithms, this
means that

( )

log 10b = b log10 = b 1 = b

(10.2c)

which shows that raising 10 to a power is the inverse operation to taking the (base-ten) log.

100

10. Power-Law Fitting and Log-Log Graphs

With this in mind, let us take the (base-ten) logarithm of both sides of equation 10.1 and
use the properties described by equation 10.2. If we do this we get

( )

( )

log y = log kx n = log k + log x n = log k + n log x

(10.3)

Now define log x u and log y v . Substituting these into 10.3 and rearranging, we get
v = nu + log k

(10.4)

Now, this is the equation of a straight line. This means that if we graph v vs. u (that is, log y vs.
log x), we should end up with a straight line, even if we do not know what n and k are.
Furthermore,the slope of this line is the unknown exponent n in equation 10.1. We can
therefore find the value of n by calculating the slope in the usual way. That is,
n=

v v2 v1 log y2 log y1
=
=
u u 2 u1 log x2 log x1

(10.5)

The value of the intercept (which is the value of v = log y when u = log x = 0 ) is log k , so if we
can find the intercept and its uncertainty, we can find k and its uncertainty.
In summary, we can take any relationship of the form given in equation 10.1, take the
logarithm of both sides, and convert it to a linear relationship whose slope and intercept are
related to the unknown values of n and k. This is, therefore, a very powerful way of learning
about unknown power-law relationships (and displaying them). A graph that plots log y versus
log x in order to linearize a power-law relationship is called a log-log graph.
10.2 AN EXAMPLE OF A LOG-LOG GRAPH

As an example, consider a hypothetical experiment testing how the period of an object


oscillating at the end of a spring depends on the objects mass. Table 10.1 gives a set of
measurements taken during this experiment, Figure 10.1 shows a graph of period vs. the mass.
Table 10.2 shows the base-10 logs of the measurement data, while Figure 10.2 shows a graph of
log T vs. log M.
Table 10.1
Mass (kg)
0.125
0.325
0.525
0.725
0.825

Period (sec)
2.42
3.76
4.75
5.52
5.87

Table 10.2
log(Mass)
-0.903
-0.488
-0.280
-0.140
-0.084

log(Period)
0.384
0.575
0.677
0.742
0.769

101

10. Power-Law Fitting and Log-Log Graphs

log(Period)

Period (sec)

0
0

0.2

0.4

0.6

0.8

0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-1

Mass (kg)

Figure 10.1: Graph of the period of oscillation


as a function of mass.

-0.8

-0.6

-0.4

-0.2

log(Mass)

Figure 10.2: Graph of the log of the period as


a function of the log of the mass.

We can see that the graph of the period vs. the mass does not yield a very good straight
line; if the uncertainties are smaller than the dots representing the data points, we would have to
say that a straight line is inconsistent with the data. On the other hand the plot of log T vs. log M
is a very nice straight line, suggesting that the period T and the mass M have a power-law
relationship.
What are n and k according to this experiment? We can easily get a quick estimate from
the graph. For the sake of round numbers, consider the points marked with squares in Figure
10.2. The slope of this graph (rise over run) is thus
n=

log T2 log T1
0.72 0.43
=
= 0.48
log M 2 log M 1 0.80 0.20

(10.6)

The two points that you choose to compute the slope need not correspond to actual data points:
simply choose convenient points on your drawn line near the ends of the line. I chose the points
so that the denominator of the expression above would be simple. Since exponents in physical
situations are most often integers or simple fractions, we might guess that the actual value of n is
. (This turns out to be the theoretical value as well, as we will see chapter N12 in the class
text.)
The intercept is the place where the line crosses the log M = 0 grid line. According to the
graph, this is roughly where log T = 0.82 (note that the log M = 0 line is the right edge of the
graph here, not the left!). So the intercept is 0.82 = log k, which means that
k = 100.82 = 6.6 s/kg1/2.

102

10. Power-Law Fitting and Log-Log Graphs

10.3 A COMMENT ABOUT LOGARITHMS AND UNITS

You may also have noticed that units seem to spri


spring
ng in and out of these calculations
rather
ra
ther haphazardly. This behavior conflicts with a general
general rule about special functions: the log
function, like sine, cosine, and the exponential function, is supposed to have a dimensionless
function,
argument. That is, the number you take the logarithm of is
argument.
is supposed to be a pure number, with
no units or dimensions (like seconds or centimeters), attached
attached to it. What's going on?
One can think of a number with units as the product
product of the number part and the units part;
that
that is, 10 cm is 10 (a pure number) multiplied by the unit
unit of centimeters. When you take the
logarithm
logarithm of a number with units, then, you are taking the logarithm of this product, which
behaves
behaves like the logarithm of all products: the result is the sum of the logarithms of the two
numbers making up the product. The logarithm of 10 cm is therefore log (10) + log (cm) =
1 + log (cm). You can't give a numerical result for log cm, which
which may seem rather disturbing.
Fortunately, this all works out fine anyway, because
because you typically find the logarithm of a
quantity with units only in the process of finding the difference between two logarithms of
quantities with the same units. Consider, for example, the situation where we compute the slope
using equation 10.6. If we attach to each logarithm in the numerator the appropriate term of log s
(where s is the unit of seconds here), we see that two log s terms cancel out when we subtract,
leaving a unitless number in the numerator. The same thing happens in the denominator.
Therefore, the slope ends up being a unitless number, as it should be.
To find the units of k, note that equation 10.4 in this situation really ought to read
log + log(sec) = n log + n log(kg ) + log k ,

(10.7)

where in this expression we are considering and to be the unitless parts of T and M
respectively. The intercept is the point where the line crosses the vertical grid line corresponding
to log = 0: we see from the graph that log has the value log 0 = 0.82 there. Therefore
equation 10.7 implies that
log 0 + log(sec) = n 0 + n log(kg ) + log k log k = log 0 + log(sec) n log(kg)

(10.8)

When we take the antilog of (that is, 10 to the power of) both sides of this, all the items in logs
get multiplied together, so we get (assuming that n is really 1/2):
k=

10log 0 sec 100.82 sec


sec
=
= 6.6 1/2
kg n
kg1/2
kg

(10.9)

Keeping track of these unit terms when working with logarithms involves a lot of work,
however, and less often pays off the way that keeping track of units in normal equations does.
Therefore, people generally ignore the units associated with logarithmic quantities, and fill in the
units of quantities after taking the antilog (as we did with k in the last section) to make them

103

10. Power-Law Fitting and Log-Log Graphs

consistent across the master equation 10.1. But if you ever get confused about units and want to
make sure that things work out correctly, this is how to do it.
10.4 A PROCEDURE FOR EXPLORING POWER-LAW RELATIONSHIPS

Log-log graphs are most useful when you suspect your data has a power-law dependence
and you want to test your suspicion. Sometimes your suspicion is based on a theoretical
prediction, sometimes a previous low-level Cartesian plot. Figures 10.3(a) through 10.5(a) are
typical Cartesian graphs that could be power laws. Whatever the source of your suspicion, your
next step is to plot the logarithms of your data as a low-level graph. If this graph looks like a
pretty good straight line (within your experimental uncertainties) you can proceed to the next
steps.
y=x^a, a > 1

y=x^a, 0 < a < 1

y=x^a, a > 1

40

40

2.5

30

30

20

20

10

10

2
1.5
1

0.5
0

6
x

Fig. 10.3(a)

10

Fig. 10.3(b)

10

10

Fig. 10.3(c)

Once you have plotted the points, you should use a ruler to draw the straight line that you
think best fits your data. You can then use this line to estimate the slope n using equation 10.6.
You can also estimate the value of the constant k in equation 10.1 by extrapolating your straight
line back to the vertical grid line where the value of the independent variable (lets call it x) is
equal to 1 (and thus log x = 0 ): the value of log k is the vertical scale reading where your best fit
line crosses this vertical grid line where log x = 0 . Note that this vertical line may not correspond
to the left edge of your graph! In Figure 10.2, for example, it happens to be at the right edge of
the graph, and on a general log-log graph, it could be almost anywhere. (If the line log x = 0 is
off the edge of your graph, you can often bring it onto the graph by changing the units of x. For
example, if x is a distance ranging from 20 cm to 200 cm, the place where log x = 0 is when x =
1 cm, which will probably be off the left side of your graph. But if we change the units of x to
meters, then the place where log x = 0 is where x = 1 m, which is right in the middle of your
data.)
To estimate the uncertainties of these quantities, draw a new line with the largest slope
that you think might be consistent with your data, and another line with the smallest slope
consistent with your data, and find the slope and intercept for each of these lines. The greatest
and least slope will then bracket the uncertainty range of n and you can use the greatest and least
values of log k determine the greatest and least values of k, which bracket the uncertainty range
of k.

104

10. Power-Law Fitting and Log-Log Graphs

To go further than crude estimates, one needs the help of a computer. The program
LinReg, which is discussed in Chapter 8 of this manual, makes it very easy to plot log-log graphs
and find the best-fit slope (with its uncertainty) and the best-fit intercept (and its uncertainty).
EXERCISES

Exercise 10.1
The table below gives the orbital periods T (in years) of the planets known to Newton as a
function of their mean distance R from the sun in AUs (where 1 AU = the earths mean orbital
radius). Plot a log-log graph of the period versus the distance on the graph paper provided as
Figure 10.6 on the next page.
Table 10.3: Planetary Periods vs. Mean Orbital Distances
Planet

Distance (AU)

Period (yr)

Mercury

0.39

0.24

Venus

0.72

0.62

Earth

1.00

1.00

Mars

1.52

1.88

Jupiter

5.20

11.86

Saturn

9.54

29.46

log(Distance)

log(Period)

Exercise 10.2
Assuming that the period and distance are related by a power-law of the form T = kR n , where n
is an integer or simple fraction, what does your graph suggest is the likely value of n?

Exercise 10.3
Find the value of k (with appropriate units) for the data of Table 10.3 from the intercept of your
log-log graph. Combine this with the result of exercise 10.1 to find the power-law equation (of
the type given in equation 10.1) that seems to fit this data.

10. Power-Law Fitting and Log-Log Graphs

Figure 10.6

105

106

10. Power-Law Fitting and Log-Log Graphs

10.5 (OPTIONAL) USING LOG-LOG PAPER

If you have more than five or ten data points, calculating the logarithms quickly gets
tedious even with a calculator. To reduce this tedium (which would have been particularly
gruesome in the era before computers and calculators), someone invented a special kind of graph
paper called log-log paper. In effect, this kind of graph paper calculates the logarithms for you.
Imagine that you have data for an independent variable x that ranges from, say, 0.01 m to
about 10 m. The values of log x would then range from about 2.0 to 1.0, and a useful horizontal
scale might look something like this:

log x
-2.0

-1.5

-1.0

-0.5

0.0

0.5

Now, imagine that we were to also draw a scale immediately above this scale that showed the
corresponding values of x. The two scales together would look like this:

0.01 0.02

0.05

0.1

0.2

0.5

1.0

2.0

5.0

10.0
x
log x

-2.0

-1.5

-1.0

-0.5

0.0

0.5

(Note how the pattern of the spacing between marks on the upper scale is identical for each
power of 10.) Now, note that if we had graph paper that had its axes pre-labeled as shown in the
upper scale, then we could locate points on the plot directly according to their value of x rather
than having to compute the value of log x for each data point.
The way that the pattern repeats for each power of 10 makes it possible to create general
and flexible graph paper with essentially pre-labeled scales. You can repeat the pattern as
frequently as necessary in each coordinate to cover the range of your data. The graph paper for
Exercise 10.4 is an example of log-log paper which has 3 cycles of the pattern horizontally and
vertically, making it possible to display data points whose x and/or y values span up to three
powers of ten or decades. If you compare this graph paper to the double-axis shown above, you
will see that only the equivalent of x scale is displayed on this paper: the log x scale has been
suppressed for the sake of clarity, but should be considered implicit. Also you will note that the
publishers of the graph paper do not commit you to particular powers of 10: each decade is
labeled as if it spans from 1 to 10. You can cross out the numbers shown to adapt the graph paper
to the particular ranges of your data points. Figure 10.7 shows how you would do this for the
harmonic oscillator data given in Table 10.1.
The point is that with just a little relabeling you can use graph paper like this to construct
quickly a log-log graph without having to do any actual calculations of logarithms. This is great
for doing low-level, quickie graphs of a set of data that you think might reflect a power-law

107

10. Power-Law Fitting and Log-Log Graphs

relation y = kx n . You can even read the value of k directly from the graph by finding the point
where your best-fit line crosses the vertical line corresponding to x = 1 unit and reading the
vertical coordinate of this point according to the vertical axis.
But how can you compute the slope n of data drawn on such graph? Remember each axis
has an implicit linear scale that reflects the log of the value displayed. Linear means that the
change in the value of log x or log y is proportional to the physical distance on the sheet of
paper. So to find the slope, all that you have to do is measure the rise of your line (in cm on the
sheet of paper!) and divide by the run (in cm).
Using log-log paper is optional in this course; normally you will be able to use a
computer program. But you can purchase sheets of log-log paper from Connie (the department
secretary) for 10 per page if you would like to use it for quick low-level graphing.
Figure 10.7: A log-log plot of the harmonic oscillator data in Table 10.1. Notice that the paper
has only one decade in each coordinate to match the range of the data.

10.0

Time(sec)

1.0
0.10

Mass (kg)

1.00

10. Power-Law Fitting and Log-Log Graphs

(OPTIONAL) Exercise 10.4


Plot the planetary orbit data in Table 10.3 on the log-log paper on the next page, and use the
methods described in the previous section to find k and n assuming that T = kR n . Check that
these agree with the values you found before.

108

You might also like