A simple math question:

I have a simple question.

I have two values ​​MIN and MAX. Then I have a series of values ​​(X), which can be between 0 and + infinity.

Now I want to have an algorithm that maps each x value from X to the range between MIN and MAX.

+5
source share
3 answers

Only basic arithmetic is used here (no atanor exp):

MAX + (MIN - MAX) / (1 + x)

If you need to change the shape of this conformal mapping, try

MAX + (MIN - MAX) / (1 + f (x))

for any positive function f (for example, f (x) = kx or f (x) = √x or ...).

+6
source

MIN + atan (x) * (MAX-MIN) / (PI / 2)

+4

, :

MAX + (MIN - MAX)*exp(-k*x)

Where kis the speed coefficient that determines how fast it approaches MAX.

+3
source

All Articles