Hi all,
Perhaps someone can help me with this. I just got the payback for skipping too many math classes, so bear with me and my misuse of math terms...
I want a function that converts a linear value to a logarithmic counterpart, with the ability to adjust the "curve" of the logarithmic scale.
The function can look something like this:
double Scale(double value, double base, double maxValue)
value = what I want to convert to it's logarithmic counterpart
base = describes the logarithmic curve. For example 1 = linear, and -1 and +1 are the extremes in either direction
maxValue = this value should count as the extreme end of the curve
See this image for an idea of what I'm looking for:
http://en.wikipedia.org/wiki/Image:600px-LinLinScale.png
The results are not going to be used scientifically so it doesn't matter that "a logarithmic scale cannot have a maxvalue" etc. The results are just going to help humans making decisions, so they don't have to be (actually they can't be) exact.
Example output:
value base maxvalue returns
1 0.7 20 0.01
2 0.7 20 0.03
3 0.7 20 0.10
4 0.7 20 0.20
20 0.7 20 1
30 0.7 20 1
With a higher base, the increase of the returnvalue would be more dramatic.
This could be solved with a simple Math.Pow(value, baseValue), but that curve isn't flexible enough. I quite possibly need TWO basevalues that control the shape of the curve. (Two magnets if you will). For example, the increase should be slower in the beginning, and increase more dramatically when we're reaching maxValue.
Can one of you math geniuses help me with an example function or perhaps give me some friendly pointers I suspect I have to combine Math.Log or Math.Pow with perhaps Math.Sin!
Thanks for any help!
//Sire