Convert Linear scale to Logarithmic

Notation

As is the convention both in mathematics and programming, the “log” function is taken to be base-e. The “exp” function is the exponential function. Remember that these functions are inverses we take the functions as:

exp : ℝ → ℝ+, and

log : ℝ+ → ℝ.

Solution

You’re just solving a simple equation here:

y = a exp bx

Solve for a and b passing through the points x=0.1, y=0.1 and x=10, y=10.

Observe that the ratio y1/y2 is given by:

y1/y2 = (a exp bx1) / (a exp bx2) = exp b(x1-x2)

Which allows you to solve for b

b = log (y1/y2) / (x1-x2)

The rest is easy.

b = log (10 / 0.1) / (10 – 0.1) = 20/99 log 10 ≈ 0.46516870565536284

a = y1 / exp bx1 ≈ 0.09545484566618341

More About Notation

In your career you will find people who use the convention that the log function uses base e, base 10, and even base 2. This does not mean that anybody is right or wrong. It is simply a notational convention and everybody is free to use the notational convention that they prefer.

The convention in both mathematics and computer programming is to use base e logarithm, and using base e simplifies notation in this case, which is why I chose it. It is not the same as the convention used by calculators such as the one provided by Google and your TI-84, but then again, calculators are for engineers, and engineers use different notation than mathematicians and programmers.

The following programming languages include a base-e log function in the standard library.

In fact, I cannot think of a single programming language where log() is anything other than the base-e logarithm. I’m sure such a programming language exists.

Leave a Comment