Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have some knobs with an internal value of $0$ to $1$. These represent a value in a range, like $1$ to $1000$. Case in point, I would like to be able to change the scale/growth of the display value. For instance, the display value with linear growth:

ling(x) =  min + (max-min) * x

Where $x$ is between $0$ and $1$. Similarly with exponential growth:

expg(x) = min * (max/min)^x

Is there a similar rule/formula with logarithmic properties?

edit: Okay i've been trying out some different things. Originally i worked with this:

logg(x) = (max - min)/log(max - min + 1) * log((max - min) * x + 1) + min

But i realized the slope was not the inverse of the expg function (which should be an identity of the logarithmic function?). I decided to mirror the expg(x) function instead:

lelogg(x) = ling(1 - x) - expg(1 - x) + ling(x)

which seems perfect:

enter image description here

but it begs the question, which of these graphs has true logarithmic / exponential growth?

share|improve this question

1 Answer 1

ling(x) is a linear function as it corresponds to $y=a+bx$ if you set min=a and max=a+b

expg(x) is an exponential function as it corresponds to $y=ae^{bx}$ if you set min=a and max=a*exp(b)

logg(x) is almost a logarithmic function of the form $y=a\log(x)+b$ except that you have log((max - min) * x + 1) when log((max - min) * x) would be better, and in general the whole expression could be simpler

lelogg(x) is not a logarithmic function, but instead the difference between a constant and a negative exponential function, so is bounded above, unlike a logarithmic function. Note that ling(1 - x) + ling(x)is the same as max+min

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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