Semi-log plots: straightening exponential data with logarithms
Exponential data curves upward more and more steeply. Is there a way to look at it so that it lies along a straight line, with its factor showing up as a slope?
Where you are 11 in Logarithms
When you reach for it
A table of values climbs faster and faster. Is it exponential, and if so, what are its starting value and factor? Building an exponential model from two points builds a model from two readings, but a real table has many readings, and two of them cannot tell you whether the rest agree. A graph can, but the eye is poor at telling one upward curve from another. It is very good at telling a straight line from a bend.
Logarithms turn the question into one about a line. They change multiplying into adding, so a quantity multiplied by the same factor at every step has a logarithm that goes up by the same amount at every step. Plot the logarithm of the output and exponential data lies on a line; take logarithms of both variables and a power law y = ax^p lies on one too. In this lesson \log is the common logarithm, base 10.
The procedure
Why the logarithm straightens an exponential. Suppose y = a \cdot b^x with a > 0 and b > 0. The logarithm of a product is the sum of the logarithms, and the logarithm of a power brings the exponent down (Laws of logarithms):
Call Y = \log y. Then Y = (\log b)\,x + \log a, a linear function of x with slope \log b and intercept \log a. In words: each step of 1 in x multiplies y by b, so it adds \log b to \log y. Equal ratios in y become equal differences in \log y.
Plot the logarithm. Make a second table of the points (x, \log y) and plot it on ordinary axes. Or plot y itself on semi-log paper, where the horizontal axis is ordinary and the vertical axis is a logarithmic scale: the value y is placed at height \log y, so the two pictures are the same.
Test for a line. With equal steps in x, the points lie on a line exactly when the differences of \log y are all equal. Measured data rounds and wobbles, so the test is that they are nearly equal, with no steady trend up or down.
Read the line, then undo the logarithms. If the line is \log y = mx + c, then raising 10 to each side and using 10^{\log y} = y with the laws of exponents gives
so a = 10^c and b = 10^m. A rising line (m > 0) means growth (b > 1); a falling line means decay.
Any base works. With natural logarithms, \ln y = \ln a + x \ln b, the slope is \ln b and b = e^m, a = e^c. Switching base multiplies every logarithm by the same constant (Change of base), which rescales the vertical axis but cannot bend a line.
Power laws: logarithms of both variables. If y = a x^p with a > 0 and x > 0, the same two laws give
Now \log y is linear in \log x, not in x. Plot (\log x, \log y), a log-log plot: the slope is the exponent p and the intercept, where \log x = 0 and so x = 1, is \log a.
| Model | A line when you plot | Slope | Intercept |
|---|---|---|---|
| y = mx + c | (x, y) | m | c |
| y = a \cdot b^x | (x, \log y) | \log b | \log a |
| y = a x^p | (\log x, \log y) | p | \log a |
Worked examples
Straightening a table of views
Lindiwe posts a clip online and records its total views V, in thousands, t days after posting.
| t | V |
|---|---|
| 0 | 4.0 |
| 1 | 7.2 |
| 2 | 13.0 |
| 3 | 23.3 |
| 4 | 42.0 |
| 5 | 75.6 |
Show that the views grow exponentially and find a model.
SolutionThe differences of V are 3.2, 5.8, 10.3, 18.7, 33.6, growing every day, so the views are not linear. Take the logarithm of each reading, to three decimal places:
| t | V | \log V |
|---|---|---|
| 0 | 4.0 | 0.602 |
| 1 | 7.2 | 0.857 |
| 2 | 13.0 | 1.114 |
| 3 | 23.3 | 1.367 |
| 4 | 42.0 | 1.623 |
| 5 | 75.6 | 1.879 |
The differences are 0.255, 0.257, 0.253, 0.256, 0.256. They are nearly equal, and the wobble has no trend; it comes from rounding V to one decimal place. So the points (t, \log V) lie close to a line, and the views are exponential.
The slope from the first point to the last is \displaystyle \frac{1.879 - 0.602}{5} = 0.2554, and the intercept is 0.602. Undoing the logarithms, b = 10^{0.2554} \approx 1.80 and a = 10^{0.602} \approx 4.0, so
Each day the views are multiplied by 1.8, a growth of 80\% a day. Check: V(3) = 4(5.832) = 23.328, which rounds to the recorded 23.3.
From a fitted line back to the model
Nurlan’s clip peaked on day t = 0, and since then the views it gets each day, D, have been falling. He plots (t, \log D), and a line fitted through the points is \log D = 3.6 - 0.12t. Find the exponential model, the percent fall per day, and the line’s prediction for day 10.
SolutionRaise 10 to each side. By the product of powers and the power of a power,
Here 10^{3.6} \approx 3981 and 10^{-0.12} \approx 0.7586, so D \approx 3981(0.7586)^t. Each day brings 75.86\% of the day before, a fall of about 24.1\% a day: the slope is negative, so the factor is below 1.
The prediction is easiest on the line itself: \log D = 3.6 - 0.12(10) = 2.4, so D = 10^{2.4} \approx 251 views on day 10.
Two points on semi-log paper
Ixchel tracks the shares S of her clip and plots them on semi-log paper against days t. She draws the line through (2, 30) and (8, 480). Find the exponential model.
A straight line on semi-log paper means \log S is linear in t, so S is exponential. In the coordinates (t, \log S) the slope is
using the quotient law, \displaystyle \log 480 - \log 30 = \log \frac{480}{30}. Then b = 10^m = 16^{1/6} \approx 1.587. This is the same factor Building an exponential model from two points gives: over 6 days the shares are multiplied by 16, so b^6 = 16. The paper simply draws that ratio as a rise.
From 30 = a \cdot b^2 and b^2 = 16^{1/3}, \displaystyle a = \frac{30}{16^{1/3}} \approx 11.91, so S \approx 11.91(1.587)^t.
A power law: logarithms of both variables
Ixchel is handed this table. Decide which plot straightens it and find its rule.
| x | 1 | 4 | 9 | 16 |
|---|---|---|---|---|
| y | 3 | 24 | 81 | 192 |
Try the semi-log plot first. The values of \log y are 0.477, 1.380, 1.908, 2.283, and the slopes between neighboring points (x, \log y) are \displaystyle \frac{0.903}{3} = 0.301, then \displaystyle \frac{0.528}{5} \approx 0.106, then \displaystyle \frac{0.375}{7} \approx 0.054. They keep shrinking, so the table is not exponential.
Now take logarithms of x as well: \log x is 0, 0.602, 0.954, 1.204. The slope between the first two points (\log x, \log y) is exactly
and the next two slopes are \displaystyle \frac{\log(27/8)}{\log(9/4)} and \displaystyle \frac{\log(64/27)}{\log(16/9)}, which are \displaystyle \frac{3}{2} for the same reason. The log-log points lie on a line of slope 1.5 through (0, \log 3), so \log y = \log 3 + 1.5 \log x and
Check: x = 9 gives 3 \cdot 9^{1.5} = 3 \cdot 27 = 81.
Two clips on one semi-log plot
Lindiwe’s views follow V = 4(1.8)^t and Nurlan’s newer clip follows W = 10(1.8)^t, both in thousands. Describe their lines on one semi-log plot, and find how many days Lindiwe’s clip lags behind Nurlan’s.
SolutionThe lines are \log V = \log 4 + t \log 1.8 and \log W = 1 + t \log 1.8. They have the same slope, so they are parallel: the same factor shows up as the same steepness. The vertical gap is 1 - \log 4 = \log 2.5 \approx 0.398 at every t, and by the quotient law that gap is \displaystyle \log \frac{W}{V}, so Nurlan’s clip always has 2.5 times as many views.
The horizontal gap is the lag. Lindiwe’s clip reaches Nurlan’s level h days later when \log 4 + (t + h)\log 1.8 = 1 + t \log 1.8, that is h \log 1.8 = \log 2.5, so
days. Check: 4(1.8)^{1.559} \approx 10, so 1.559 days of growth turns 4 thousand into 10 thousand.
Boundaries
- Every output must be positive. \log y exists only for y > 0, so a reading of 0 or a negative reading cannot go on a semi-log plot. A log-log plot needs every x > 0 as well, so the point x = 0 of a power law cannot be drawn.
- Only y = a \cdot b^x straightens. If a constant is added, y = a \cdot b^x + k with k \neq 0 and b \neq 1, then \log y is not linear in x, because the logarithm of a sum is not the sum of the logarithms. Growth that levels off, as in Logistic growth: when growth levels off, bends downward on semi-log paper.
- Data is straight only approximately. A line is fitted by eye or by technology, and different fits give slightly different a and b.
- A line describes the readings you have. Extending it to later times assumes the same factor keeps applying, which the data alone cannot promise.
Where this goes next
Statistics uses the same move to fit models to scattered data: Transforming to linearity: logs and exponential models straightens a curved scatterplot, and Log-log transforms and power models fits power models from log-log plots, with residuals measured on the logarithmic scale. When growth starts exponential and then levels off, the semi-log plot shows the moment it stops being a line, which is where Logistic growth: when growth levels off take over.
Exercises
Straightening a table
- Show that x: 0, 1, 2, 3, 4 with y: 5, 15, 45, 135, 405 lies on a line in the plot of (x, \log y), and find the model.
- Show that x: 0, 1, 2, 3 with y: 2000, 1600, 1280, 1024 is exponential, and find the model.
- Is x: 0, 1, 2, 3 with y: 6, 12, 18, 24 exponential? Use the differences of \log y, then say what it is.
From a line to the model
- A plot of (x, \log y) follows the line \log y = 0.9 + 0.2x. Find a and b in y = a \cdot b^x.
- A plot of (x, \log y) follows \log y = 2 - 0.05x. Find the model and the percent fall per step.
- A plot of (x, \ln y) follows \ln y = 1.5 + 0.4x. Find the model.
- Lindiwe plots (t, \log V) for a second clip, with V its total views, and the line passes through (0, 2.7) and (6, 4.5). Find the model.
Semi-log paper
- On semi-log paper a line passes through (1, 20) and (4, 540). Find the exponential model.
- On semi-log paper a line passes through (0, 800) and (5, 25). Find the model.
- On semi-log paper, Nurlan’s line rises from 100 at t = 0 to 1000 at t = 6. How many days does it take the quantity to double?
- Two clips plot as parallel lines on one semi-log plot, one 0.3 higher than the other. What do the two clips share, and how many times as many views does the higher one have?
Power laws
- Show that x: 1, 2, 4, 8 with y: 5, 20, 80, 320 lies on a line in the log-log plot and find the rule.
- A log-log plot follows \log y = 0.6 + 0.75 \log x. Find the power law.
- A line on a log-log plot passes through (\log x, \log y) = (1, 2) and (3, 1). Find the power law.
- Which plot straightens x: 1, 2, 3, 4, 5 with y: 2, 16, 54, 128, 250? Find the rule.
- Which plot straightens x: 2, 4, 6, 8 with y: 3, 12, 48, 192? Find the rule.
Reasoning
- Prove the converse of the procedure: if every point (x, \log y) lies on the line \log y = mx + c, then y = a \cdot b^x. Name a and b, and explain why both are positive.
- Nurlan’s table of daily views has a day with 0 views. Explain why it cannot go on a semi-log plot, and what that says about an exponential model on that day.
- Is y = x^2, for x = 1, 2, 3, 4, a straight line on semi-log paper? Explain.
- Explain why y = 2^x + 10 does not plot as a line in (x, \log y), using the values at x = 0, 1, 2, 3.
Answers
- \log y: 0.699, 1.176, 1.653, 2.130, 2.607, each step \log 3 \approx 0.477. Slope \log 3, intercept \log 5, so y = 5 \cdot 3^x.
- \log y: 3.301, 3.204, 3.107, 3.010, each step \log 0.8 \approx -0.097. So y = 2000(0.8)^x.
- No. \log y: 0.778, 1.079, 1.255, 1.380, with differences 0.301, 0.176, 0.125 shrinking. The differences of y are all 6, so it is linear: y = 6x + 6.
- a = 10^{0.9} \approx 7.943 and b = 10^{0.2} \approx 1.585.
- a = 10^2 = 100 and b = 10^{-0.05} \approx 0.8913, so y = 100(0.8913)^x, a fall of about 10.9\% per step.
- a = e^{1.5} \approx 4.482 and b = e^{0.4} \approx 1.492, so y \approx 4.482(1.492)^x.
- Slope \displaystyle \frac{4.5 - 2.7}{6} = 0.3, so b = 10^{0.3} \approx 1.995 (nearly doubling each day) and a = 10^{2.7} \approx 501.2: V \approx 501.2(1.995)^t.
- \displaystyle b^3 = \frac{540}{20} = 27, so b = 3, and \displaystyle a = \frac{20}{3}: \displaystyle y = \frac{20}{3} \cdot 3^x.
- \displaystyle b^5 = \frac{25}{800} = \frac{1}{32}, so \displaystyle b = \frac{1}{2}, and a = 800: \displaystyle y = 800\left(\frac{1}{2}\right)^x.
- \log y rises 1 in 6 days, slope \displaystyle \frac{1}{6}. Doubling adds \log 2, which takes 6 \log 2 \approx 1.806 days.
- The same growth factor (equal slopes). The gap 0.3 is \log of the ratio, so the higher clip has 10^{0.3} \approx 1.995, about 2, times as many views at every time.
- Each doubling of x multiplies y by 4, so every slope is \displaystyle \frac{\log 4}{\log 2} = 2; the intercept is \log 5. So y = 5x^2.
- y = 10^{0.6} x^{0.75} \approx 3.981 x^{0.75}.
- Slope \displaystyle \frac{1 - 2}{3 - 1} = -0.5, intercept 2 + 0.5 = 2.5, so y = 10^{2.5} x^{-0.5} \approx 316.2 x^{-0.5}.
- The log-log plot. The ratios 8, 3.375, \dots are not constant, so not exponential; the log-log slope is \displaystyle \frac{\log 16 - \log 2}{\log 2} = 3 throughout, and y = 2x^3.
- The semi-log plot: each step of 2 in x multiplies y by 4, so b^2 = 4, b = 2, and \displaystyle a = \frac{3}{2^2} = 0.75: y = 0.75 \cdot 2^x.
- y = 10^{\log y} = 10^{mx + c} = 10^c (10^m)^x, so a = 10^c and b = 10^m. A power of 10 is always positive, so both are.
- \log 0 is undefined: no power of 10 equals 0. An exponential a \cdot b^x with a > 0, b > 0 is never 0 either, so on that day the model fails.
- No. \log y = 2 \log x gives 0, 0.602, 0.954, 1.204, and the differences 0.602, 0.352, 0.250 shrink, so the points bend downward. It is a line on a log-log plot instead.
- The values are 11, 12, 14, 18, with logarithms 1.041, 1.079, 1.146, 1.255 and differences 0.038, 0.067, 0.109 that keep growing. The added 10 spoils equal ratios: \displaystyle \frac{12}{11} \neq \frac{14}{12}.