Can anyone explain why the error for $\ln (x)$ (where for $x$ we have $x\pm\Delta x$) is simply said to be $\frac{\Delta x}{x}$? I would very much appreciate a somewhat rigorous rationalization of this step. Additionally, is this the case for other logarithms (e.g. $\log_2(x)$), or how would that be done?


Simple error analysis assumes that the error of a function $\Delta f(x)$ by a given error $\Delta x$ of the input argument is approximately $$ \Delta f(x) \approx \frac{\text{d}f(x)}{\text{d}x}\cdot\Delta x $$ The mathematical reasoning behind this is the Taylor series and the character of $\frac{\text{d}f(x)}{\text{d}x}$ describing how the function $f(x)$ changes when its input argument changes a little bit. In fact this assumption makes only sense if $\Delta x \ll x$ (see Emilio Pisanty's answer for details on this) and if your function isnt too nonlinear at the specific point (in which case the presentation of a result in the form $f(x) \pm \Delta f(x)$ wouldnt make sense anyway). Note that sometimes $\left| \frac{\text{d}f(x)}{\text{d}x}\right|$ is used to avoid getting negative erros.

Since $$ \frac{\text{d}\ln(x)}{\text{d}x} = \frac{1}{x} $$ the error would be $$ \Delta \ln(x) \approx \frac{\Delta x}{x} $$

For arbitraty logarithms we can use the change of the logarithm base: $$ \log_b x = \frac{\ln x}{\ln b}\\ (\ln x = \log_\text{e} x) $$ to obtain $$ \Delta \log_b x \approx \frac{\Delta x}{x \cdot \ln b} $$

  • 1
    $\begingroup$ This (nice) answer is correct for the case that $\Delta x\ll x$ but will otherwise fail; see my answer below for why and what to do there. $\endgroup$ – Emilio Pisanty Jan 25 '14 at 21:29
  • $\begingroup$ very right, thx for pointing out, ill add a short note to point out your details on that. $\endgroup$ – LeFitz Jan 26 '14 at 7:42
  • $\begingroup$ btw, I looked up the taylor series thing and now I am thinking, why do we bother this at all? Wouldn't it be "infinitely" more precise to simply evaluate the error for the ln (x + delta x) as its difference with ln (x) itself?? I guess we could also skip averaging this value with the difference of ln (x - delta x) and ln (x) (i.e. take upper bound difference directly as the error) since averaging would dis-include the potential of ln (x + delta x) from being a "possible value". Am I wrong or right in my reasoning? $\endgroup$ – Just_a_fool Jan 26 '14 at 12:51
  • $\begingroup$ its not a good idea because its inconsistent. if you only take the deviation in the up direction you forget the deviation in the down direction and the other way round. in your example: what if df_upp= f(x+dx)-f(x) is smaller than df_down = f(x)-f(x-dx)? giving the result in the way f +- df_upp would disinclude that f - df_down could occur. Also averaging df = (df_up + df_down)/2 could come to your mind. With only 1 variable this is not even a bad idea, but you get troubles when you have a function f(x,y,...) of more input, which is why the method presented in my answer is preferable. $\endgroup$ – LeFitz Jan 26 '14 at 14:26
  • $\begingroup$ @LeFitz On the other hand, if the data does have an asymmetric spread about its central value, it is misleading to give an uncertainty which implies a symmetric spread. In such cases one should use notation indicates the asymmetry, such as $y=1.2^{+0.1}_{-0.3}$. $\endgroup$ – Emilio Pisanty Jan 28 '14 at 15:10

While appropriate in many important contexts, LeFitz's answer can fail in one important situation, and can lead you astray, for example, when plotting graphs in logarithmic scale.

More specifically, LeFit'zs answer is only valid for situations where the error $\Delta x$ of the argument $x$ you're feeding to the logarithm is much smaller than $x$ itself: $$ \text{if}\quad \Delta x\ll x\quad\text{then}\quad \Delta\ln(x)\approx\frac{\Delta x}{x}. $$

However, if this condition fails then the result also fails. The reason for this is that the logarithm becomes increasingly nonlinear as its argument approaches zero; at some point, the nonlinearities can no longer be ignored.

One immediately noticeable effect of this is that error bars in a log plot become asymmetric, particularly for data that slope downwards towards zero. For example:

Log plot with asymmetric error bars

(Image source)

This asymmetry in the error bars of $y=\ln(x)$ can occur even if the error in $x$ is symmetric. Consider, for example, a case where $x=1$ and $\Delta x=1/2$. Here you'll observe a value of $$y=\ln(x+\Delta x)=\ln(3/2)\approx+0.40$$ with the same probability as $$y=\ln(x-\Delta x)=\ln(1/2)\approx-0.69,$$ although their distances to the central value of $y=\ln(x)=0$ are different by about 70%. In a more radical example, if $\Delta x$ is equal to $x$ (and don't even think about it being even bigger), the error bar should go all the way to minus infinity, as there is a chance that the measured variable be negative. (Unless, of course, you're doing your statistics wrong, and assuming e.g. a symmetric distribution of errors in a situation where that doesn't even make sense.)

In more general terms, when this thing starts to happen then you have stumbled out of the gaussian statistics that underpin most of the standard formulas. In such cases there are often established methods to deal with specific situations, but you should watch your step and consult your resident statistician when in doubt.

If you just want a rough-and-ready error bars, though, one fairly trusty method is to draw them in between $y_\pm=\ln(x\pm\Delta x)$. If you know that there is some specific probability of $x$ being in the interval $[x-\Delta x,x+\Delta x]$, then obviously $y$ will be in $[y_-,y_+]$ with that same probability.

  • $\begingroup$ <3 this is just what I was suspicious of! $\endgroup$ – DilithiumMatrix Apr 28 '17 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.