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 "ratio" 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

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

Archive

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