Calculating number from one collection basing on a nother collection number

81 Views Asked by At

I have a collection of numbers between 19.75 and 20.25 and a number that is between that borders lets say its 20.10.

Now basing on that need to calculate equivalent of that number (20.10) but in collection between 120 and 160.

I think what I am trying to say what would be equivalent of a number from first collection in a second (number between 120 - 160)

1

There are 1 best solutions below

0
On BEST ANSWER

The idea here is to consider a set with a known minimim and maxmim values. We want to make a transformation that associates a number between $0$ and $1$ to every element in the set, so that the minimim value gets transformed into $0$ and maximum value gets transformed into $1$. All the other values are then somewhere in between. For any set, this transformation is $$ f(x) = \frac{x - \text{min}}{\text{max} - \text{min}} $$ It's easy to see that $f(\text{min}) = 0$ and $f(\text{max}) = 1$.

In the example case, we have $\text{min}= 19.75$ and $\text{max}= 20.25$. We want to transform $x=20.10$, resulting in $$ f(20.10) = \frac{20.10 - 19.75}{20.25 - 19.75} = 0.7 $$ The question was, which value gets transformed into this value ($0.7$) when $\text{min}=120$ and $\text{max}=160$. We just need to form the equation: $$ \frac{x - 120}{160-120} = 0.7 \qquad \Rightarrow \qquad x - 120 = 28 $$ and therefore $x=148$. We can check the result: $$ \frac{148 - 120}{160-120} = 0.7 $$ Therefore, the answer of $x=148$ is correct.