Does anyone know a simply conversion algorithm to turn a number range of 1 to 10 into a decimal range of .5 to 1?
Even more complicated (to me), another algorithm to covert a range of -1 to -10 into a decimal range of .5 to 1?
Does anyone know a simply conversion algorithm to turn a number range of 1 to 10 into a decimal range of .5 to 1?
Even more complicated (to me), another algorithm to covert a range of -1 to -10 into a decimal range of .5 to 1?
Copyright © 2021 JogjaFile Inc.
I don't know what mathematical requirement(s) are intended for an algorithm, but a basic "find an equation of the line containing two given points in the coordinate plane" algebra 1 problem may be all you need. To map (in a simple way) numbers in the closed interval $[a,b]$ to the closed interval $[c,d],$ find an equation of the line that passes through the points $(a,c)$ and $(b,d).$
Doing this gives
$$ y \;\; \text{minus}\;\; (y\text{-coordinate}) \;\; = \;\; (\text{slope})\left(x \;\; \text{minus}\;\; (x\text{-coordinate})\,\right) $$
$$ y - c \;\; = \;\;\left(\frac{d-c}{b-a}\right)(x-a) $$
$$ f(x) \;\; = \;\; \left(\frac{d-c}{b-a}\right)(x-a) \; + \; c $$