# Converting problem

• Sep 21st 2012, 10:10 AM
hanodee
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,
• Sep 21st 2012, 01:45 PM
emakarov
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.
• Sep 21st 2012, 02:46 PM
hanodee
Re: Converting problem

How about if I dont know the upper bound for x?
• Sep 21st 2012, 02:49 PM
emakarov
Re: Converting problem
Quote:

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.
• Sep 21st 2012, 03:56 PM
johnsomeone
Re: Converting problem
Quote:

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