1
$\begingroup$

Let's say i have

N1 = -584

N2 = 110

Z = 0.64

How do i calculate from Z which value is it in range of N1..N2? Z is range from 0 to 1.

  • 1
    For example, i need to calculate where object should be placed on X axis, but i know only the percentage where it can be (0 - far left = -584, 1 = far right, +110)2012-10-03

2 Answers 2

0

If by $Z=0.64$ you want a number that $64\%$ of the way from $-584$ to $110,$ the expression is $-584 + 0.64(110-(-584))$

  • 0
    Exactly! Thanks!2012-10-03
1

We want to map numbers in the interval $[0,1]$ to numbers in your interval $[-584,110]$ by a function $fx)$ of the shape $f(x)=px+q$.

We want $f(0)=-584$, and $f(1)=110$, so $q=-584$ and $p=694$.

So our function is $694x-584$. Plug in $x=0.64$.

Remark: Exactly the same idea will work if our target interval is, say, $[a,b]$. We get $q=a$ and $p=b-a$. So the linear function $f(x)$ that maps $[0,1]$ to $[a,b]$ is given by $f(x)=(b-a)x+a$.