mscroggs.co.uk
mscroggs.co.uk

subscribe

Blog

 2020-03-31 
Recently, you've probably seen a lot of graphs that look like this:
The graph above shows something that is growing exponentially: its equation is \(y=kr^x\), for some constants \(k\) and \(r\). The value of the constant \(r\) is very important, as it tells you how quickly the value is going to grow. Using a graph of some data, it is difficult to get an anywhere-near-accurate approximation of \(r\).
The following plot shows three different exponentials. It's very difficult to say anything about them except that they grow very quickly above around \(x=15\).
\(y=2^x\), \(y=40\times 1.5^x\), and \(y=0.002\times3^x\)
It would be nice if we could plot these in a way that their important properties—such as the value of the ratio \(r\)—were more clearly evident from the graph. To do this, we start by taking the log of both sides of the equation:
$$\log y=\log(kr^x)$$
Using the laws of logs, this simplifies to:
$$\log y=\log k+x\log r$$
This is now the equation of a straight line, \(\hat{y}=m\hat{x}+c\), with \(\hat{y}=\log y\), \(\hat{x}=x\), \(m=\log r\) and \(c=\log k\). So if we plot \(x\) against \(\log y\), we should get a straight line with gradient \(\log r\). If we plot the same three exponentials as above using a log-scaled \(y\)-axis, we get:
\(y=2^x\), \(y=40\times 1.5^x\), and \(y=0.002\times3^x\) with a log-scaled \(y\)-axis
From this picture alone, it is very clear that the blue exponential has the largest value of \(r\), and we could quickly work out a decent approximation of this value by calculating 10 (or the base of the log used if using a different log) to the power of the gradient.

Log-log plots

Exponential growth isn't the only situation where scaling the axes is beneficial. In my research in finite and boundary element methods, it is common that the error of the solution \(e\) is given in terms of a grid parameter \(h\) by a polynomial of the form \(e=ah^k\), for some constants \(a\) and \(k\).
We are often interested in the value of the power \(k\). If we plot \(e\) against \(h\), it's once again difficult to judge the value of \(k\) from the graph alone. The following graph shows three polynomials.
\(y=x^2\), \(y=x^{1.5}\), and \(y=0.5x^3\)
Once again is is difficult to judge any of the important properties of these. To improve this, we once again begin by taking the log of each side of the equation:
$$\log e=\log (ah^k)$$
Applying the laws of logs this time gives:
$$\log e=\log a+k\log h$$
This is now the equation of a straight line, \(\hat{y}=m\hat{x}+c\), with \(\hat{y}=\log e\), \(\hat{x}=\log h\), \(m=k\) and \(c=\log a\). So if we plot \(\log x\) against \(\log y\), we should get a straight line with gradient \(k\).
Doing this for the same three curves as above gives the following plot.
\(y=x^2\), \(y=x^{1.5}\), and \(y=0.5x^3\) with log-scaled \(x\)- and \(y\)-axes
It is easy to see that the blue line has the highest value of \(k\) (as it has the highest gradient, and we could get a decent approximation of this value by finding the line's gradient.

As well as making it easier to get good approximations of important parameters, making curves into straight lines in this way also makes it easier to plot the trend of real data. Drawing accurate exponentials and polynomials is hard at the best of times; and real data will not exactly follow the curve, so drawing an exponential or quadratic of best fit will be an even harder task. By scaling the axes first though, this task simplifies to drawing a straight line through the data; this is much easier.
So next time you're struggling with an awkward curve, why not try turning it into a straight line first.
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "h" then "e" then "x" then "a" then "g" then "o" then "n" in the box below (case sensitive):

Archive

Show me a random blog post
 2024 

Feb 2024

Zines, pt. 2

Jan 2024

Christmas (2023) is over
 2023 
▼ show ▼
 2022 
▼ show ▼
 2021 
▼ show ▼
 2020 
▼ show ▼
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

christmas card light tennis inverse matrices manchester turtles golden ratio map projections the aperiodical 24 hour maths accuracy stickers draughts craft palindromes sobolev spaces hats dinosaurs wool london underground live stream books errors wave scattering noughts and crosses countdown recursion logs latex puzzles preconditioning polynomials big internet math-off mean matrix of cofactors graphs squares go plastic ratio hyperbolic surfaces manchester science festival game show probability newcastle data programming rhombicuboctahedron php stirling numbers harriss spiral logic correlation estimation arithmetic platonic solids runge's phenomenon tmip bodmas talking maths in public databet menace cambridge approximation world cup graph theory logo gaussian elimination numerical analysis convergence rugby bubble bobble chalkdust magazine datasaurus dozen sport pythagoras fence posts misleading statistics trigonometry mathsjam reddit bempp chess pizza cutting gerry anderson python curvature gather town matt parker final fantasy london oeis anscombe's quartet captain scarlet asteroids matrix multiplication finite group ucl nine men's morris hannah fry video games geometry binary crossnumber computational complexity quadrilaterals guest posts hexapawn probability raspberry pi electromagnetic field european cup finite element method matrix of minors people maths dataset pascal's triangle triangles geogebra cross stitch signorini conditions machine learning phd interpolation youtube fonts sorting coins dates mathsteroids exponential growth data visualisation realhats games game of life weak imposition pac-man braiding determinants national lottery pi mathslogicbot crochet folding tube maps reuleaux polygons simultaneous equations dragon curves folding paper weather station christmas flexagons zines royal institution error bars football frobel matrices boundary element methods news advent calendar fractals sound standard deviation ternary propositional calculus inline code chebyshev royal baby speed a gamut of games javascript golden spiral statistics martin gardner pi approximation day numbers radio 4 edinburgh

Archive

Show me a random blog post
▼ show ▼
© Matthew Scroggs 2012–2024