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.

$\endgroup$
1
  • 1
    $\begingroup$ 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) $\endgroup$ Oct 3, 2012 at 23:19

2 Answers 2

1
$\begingroup$

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$.

$\endgroup$
0
$\begingroup$

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))$

$\endgroup$
1
  • $\begingroup$ Exactly! Thanks! $\endgroup$ Oct 3, 2012 at 23:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .