Map/Transform linear function to exponent

1.1k Views Asked by At

I have a slider:

min val. = 0
max val. = 20'000
step = 0.1

min, max values and step are constants. On each step (thumb position change) slider returns a current value and a thumb position in % (see. img).

How can I transform the current returned value to make it grow exponentially like on the 2nd graphic - where 0 - 8'000 - take 80% of slider width.

Red graphic:

On each step (thumb position change) slider returns a current value and a thumb position in % - current value grows linearly depending on the thumb position.

Green graphic:

This is what I need. I can only use current thumb position and current slider value as a function arguments.

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I suggest you try the following function

$$ f(x) = \alpha\tanh(\beta x) $$

where the constants $\alpha$ and $\beta$ have been selected so that $f(8000) = 0.8$ and $f(20000) = 1$. The values for the constants were determined numerically to be

$$ \alpha = 1.00912774623104, \quad \beta = 0.000134853425544814 $$

Using these values the curve $y = f(x)$ for $x\in [0,20000]$ is given by the following figure.

enter image description here