If a man speaks in a forest, and his wife's not there, is he still wrong?

Gratuitous Mathematics

General NewsHere's a good one for all you maths fiends...

Map the five values 1..5 to the range 10..50. Easy, huh? (Just in case you're not clear the answer I'm looking for is 10, 20, 30, 40, 50!)

What if the range starts at zero? i.e. map 0..5 to 10..50? Hmmm, a little more tricky but do-able. Answer: 10, 18, 26, 34, 42, 50.

Now, how about mapping the values 0..40 to the range 0..1? Erm...

Actually, it's just a case of finding a generic formula to calculate the new values from the old values. To map a series of consecutive integer values Imin .. Imax to a range of continous real values Rmin .. Rmax, I came up with the following formula:

     ( Rmax - Rmin )( Ii - Imin )
Ri = ----------------------------
           ( Imax - Imin )
where:

  • Ri is the ith value in the range
  • Rmax is the maximum value of the range
  • Rmin is the minimum value of the range
  • Ii is the ith integer in the series
  • Imin is the 1st integer in the series
  • Imax is the last integer in the series
So, back to the original question about mapping the values 0..40 to the range 0..1.

In this example:

  • Rmax = 1
  • Rmin = 0
  • Imax = 40
  • Imin = 0
So, plugging these numbers into the formula gives the following values:

R1  = (1 - 0)( 0 - 0) / (40 - 0)         = 0
R2  = (1 - 0)( 1 - 0) / (40 - 0) = 1/40  = 0.025
..
R40 = (1 - 0)(39 - 0) / (40 - 0) = 39/40 = 0.975
R41 = (1 - 0)(40 - 0) / (40 - 0) = 40/40 = 1
So, now you know.

Story Options

Gratuitous Mathematics | 0 comments
The following comments are owned by whomever posted them. This site is not responsible for what they say.

Topics

  • Home
  • Misc (6/0)
  • Audio (5/0)
  • Linux (21/0)
  • Family (1/0)
  • Fishing Diary (1/0)
  • OpenSolaris (7/0)
  • Computing (11/0)
  • General News (7/0)
  • Chloe (1/0)
  • Emily (2/0)
  • Twins (5/0)
  • Classifieds (2/0)
  • GeekLog (2/0)
  • Project Management (1/0)
  • User Functions






    Lost your password?