-2

This may be a very simple question, but I haven't been in touch with Algorithms since a while.

I have a logarithmic scale of 20,100,500,2500,12500 which relates to 1,2,3,4,5 on the respectively. Now, I want to find out as to where the value 225 would lie on the scale above? And also, going the other way round, how would I find out as to what the value for 2.3 interpret to on the scale. Would be great if someone can help me with the answer and explanation for this.

  • 2
    I'm voting to close this question as off-topic because it is about [math.se] instead of programming or software development. – Pang Aug 10 '16 at 02:46

1 Answers1

0

Note that each step in the scale multiplies the previous step by 5.

So the explicit formula for your output is

y = 4 * 5^x

or

x = log-base-5(y/4)

where

log-base-5(n) = log(n)/log(5)

if you want to compute it in code. That last line is called the change of base formula, and is explained here You can use either a natural log or common log on the right side of the formula, it doesn't matter.

roderick young
  • 284
  • 1
  • 10
  • Thanks a lot Roderick for your quick response on this! Its helpful :) – Onkar Kuncolienker Aug 09 '16 at 16:14
  • Sorry to bug you again, but how would I go about doing the same thing for 0.3,1,4,20,110 which would align to 1,2,3,4,5? This example doesn't have the simple multiplication of 5 as the previous example!. Maybe it uses a square log function? – Onkar Kuncolienker Aug 09 '16 at 17:47
  • Perhaps it would be best to ask curve-fitting questions on a math.stackexchange.com as the person above suggests. They will have a lot of good suggestions. One idea is to the a log of each output value, log(0.3), log(1), log(4), and so forth. Then plot them on a graph. If they're in a straight line, then the function can be represented by something like a * e^(bx), where a and b are not necessarily integers. By the way, if you delete this question that they don't like, you will get a badge for it. Don't feel bad about getting voted down, it's nothing personal. – roderick young Aug 11 '16 at 00:38