# Math Help - Converting problem

1. ## Converting problem

Hello,

I am a computer science student but I'm facing a math problem which is as the following:

Assuming that I have a number x (where x >=0)
And I want to do a mapping for this x to convert it to the range b1 to b2 (where 0 <= b1 < b2)

Example: if x = 45. How can I find its equivalent in the range 0 - 25 ?

Or if I should look into a specific math area. what should be?
Thank you,

2. ## Re: Converting problem

Of course, there are infinitely many ways to do this. For the simplest way, where the conversion function is linear, you need to know the range of x. For example, if x ranges over [0, 45], then x = 45 is mapped to 25 * 45 / 45 = 25. but If x ranges over [0, 10000], then x = 45 is mapped to 25 * 45 / 10000.

3. ## Re: Converting problem

How about if I dont know the upper bound for x?

4. ## Re: Converting problem

Originally Posted by hanodee
How about if I dont know the upper bound for x?
Then the problem is ill-defined because it has all kinds of solutions. You need more constraints.

5. ## Re: Converting problem

Originally Posted by hanodee
You can map $[0,\infty)$ onto $[b_1, b_2)$ using the function
$f(x) = b_1 + \frac{b_2 - b_1}{\pi/2} \tan^{-1}(x)$