How to map interval $[0, 100]$ to the interval $[100, 350]$?

1.3k Views Asked by At

I have an interval $[0; 100]$ and would like to map it to this new interval: $[100;350]$.

I thought about multiplying it by $3.5$, but that would give the interval $[0;350]$. And adding to each of these elements $100$ would give: $[100;450]$. Hence my question: is it possible to do what I want?

Note that I can settle for the interval $[0;350]$ : in my program, it will be enough if I exclude the numbers present in the interval $[0;99]$.

5

There are 5 best solutions below

0
On BEST ANSWER

To map from $[a,b]$ to $[c, d]$,

Consider the straight line that connects $(a,c)$ to $(b,d)$.

We have the slope $m = \frac{d-c}{b-a},$ we are able to recover $m$.

$$y=mx+C$$

To recover $C$, just substitute one of the value say $(a,c)$ and solve for $C$. For our example, we have $a=0$ and $c=100$.

Hence your transformation can be of the form of $y=mx+100$. Can you compute the $m$ to find what you want?

0
On

The ratio of the lengths of the intervals is $2.5 :1,$ the position of the left extremity is shifted by $100.$ So take the mapping $$f(x)=2.5x+100.$$

0
On

You can consider $x\mapsto ax + b\colon [0,100]\to [100,350]$ such that $0\mapsto 100$ and $100\mapsto 350$.

Thus, $$a \cdot 0 + b = 100,\\ a\cdot 100 + b = 350,$$ and solving it gives $a = \frac 52$, $b = 100$.

In general, the same technique works for intervals $[x_1,x_2]$ and $[y_1,y_2]$:

$$ax_1 + b = y_1\\ ax_2 + b = y_2.$$

Solving it gives $a = \frac{y_2 - y_1}{x_2 -x_1}$ and $b = y_1 - ax_1$. All in all, it's a line $$y - y_1 = \frac{y_2-y_1}{x_2-x_1}(x-x_1).$$ Looks familiar?

5
On

Since $100\cdot t^0=100$ for any positive $t$, we find $t$ such that $100\cdot t^{100}=350\implies t=3.5^{0.01}$. $$\boxed{y=100\cdot3.5^{0.01x}}$$ In general an exponential mapping from $[a,b]$ to $[c,d]$ is $y=c\left(\frac dc\right)^{\frac{x-a}{b-a}}$.

0
On

Another method that’s a bit more general and will come in handy if you want to map arbitrary curves is to parameterize your paths. That is, find a one-to-one mapping from your first path to $[0,1]$, $(0,1]$, or so on as appropriate. Then find a one-to-one mapping from $[0,1]$ to your second path. (The interval $[0,1]$ isn’t special, just convenient.) Finally, compose them.

Let’s say you want to map $x^2$ over the interval $[0,4]$ to $\sin x$ over the interval $[0,2\pi]$. A one-to-one mapping from the parabola to the line segment, $t: [0,4] \to [0,1]$, is $t = \sqrt{x}/2$, and a mapping from $t \in [0,1]$ to a sine wave over $[0,2\pi]$ is $\sin {2\pi t}$. Substituting, we get $\sin {\left( \pi \sqrt{x}\right)}$.

Edit: Just saw a great illustration of the mapping between the normal and log-normal distributions.

Normal and log-normal distributions