[Math] Interpret a linear scale as a logarithmic scale

logarithms

Answer

The solution to my question is $10^{\log{logMin}+\frac{x-linMin}{linMax-linMin}(\log{logMax}−\log{logMin})}$ with $x$ being a value on a linear scale $linMin$ to $linMax$ that is being converted to the logarithmic scale $logMin$ to $logMax$.

Question

I've already looked here Convert a linear scale to a logarithmic scale but the answer provided is specific to the question posters values and since I can't add comments I'm asking again:

Given a logarithmic scale and a linear scale, how do I interpret a linear value as a logarthmic value.

Given are 5 values, a value on the linear scale, the minimal value on either scales and the maximal values on either scales.

liMin |---[xLin]--------| liMax
              |
      f(xLin) = ? = xLog
              v
loMin |---[xLog]--------| loMax

(Actual example)

Lin: 0   |------[5]------| 10
                 |
          f(5) = ? = 1
                 v
Log: 0.1 |------[1]------| 10

What I figuered so far from the thread is that you have two equations

$loMin=k\log {liMin}+c$ and

$loMax=k\log {liMax}+c$.

Solving those for $c$ and $k$ will net

$k = \frac {loMax – loMin}{\log{liMax} – \log{liMin}}$ and

$c = \frac {loMin\log{liMax}-loMax\log{liMin}}{\log{liMax}-\log{liMin}}$.

Putting those into $f(x)=k\log{x}+c$ completely wrong results though.

Is this the correct appoach or am I doing something wrong?#

Best Answer

You should not expect the linear relationship you use to find $c,k$. It sounds like you are trying to look at the position of a point on the linear scale toget a value and find the appropriate position of the value on the log scale. Say you linear scale runs from $1$ to $100$. A point one third of the way along would correspond to $1+\frac 13(100-1)=34$. The range of the logs (using base $10$) is $0$ to $2$. As $\log_{10}34 \approx1.53$, you would plot $34$ at $\frac 12(1.53-0)$ or $0.76$ of the way along the scale.