1
$\begingroup$

I want to normalize a range of decimals into a new range from 0 to 1.

Lets say the maximum value of the range is 0.865400 and the minimum value of the range is 0.0004530.

How can I convert values from the given range into a new range from 0 to 1 ?

  • 5
    Use the mapping : $$ x \, \mapsto \, \frac{x - x_{\mathrm{min}}}{x_{\mathrm{max}} - x_{\mathrm{min}}} $$ with $x_{\mathrm{min}} = 0.0004530$ and $x_{\mathrm{max}} = 0.8654$.2017-01-03
  • 0
    Construct a line which is $0$ in the minimal value and and $1$ in the maximum value. Edit: Or just look at the comment above.2017-01-03
  • 0
    Thanks but i have another consideration. Since my purpose for normalizing data is to show the data with much less precision. ie. I want 0.000343 to convert into something like 0.124 or something (At most 3 decimal places).2017-01-04

1 Answers 1

0

You seem to look for a way to rescale an arbitrary interval $[x,y]$ onto $[0,1]$, and do so while preserving the order on these two intervals. This will be achieved by an affine function $f : [x,y] \to [0,1]$, of the general form $f(t) = at + b$. It remains to find out $a$ and $b$.

The requirements placed upon $f$ insure that $f(x) = 0$ and $f(y) = 1$, which can be rewritten as

$$\left\{ \begin{eqnarray} ax + b = 0 \\ ay + b = 1 \end{eqnarray} \right.$$

whence it quickly follows that

$$a = \frac 1 {y-x}, \qquad b = -ax = - \frac x {y-x} ,$$

so that

$$\color{red} {f(t) =} \frac 1 {y-x} t - \frac x {y-x} = \color{red} {\frac {t-x} {y-x}} .$$