Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Change -1 to 1 into 0 to 1

  1. Sep 24, 2011 #1
    Hi,
    I'm making a small app in java and part of the script retrieves an 'evaluation' factor from 'a' between -1 to 1 (e.g. 0.882) where 1 is the best and -1 is the worst.
    Now, my problem in that I need to change it into a positive factor form 'b' from 0 to 1 to compute with other factors. For example if the factor is a = 0, then b = 0.5
    I cannot gasp the math.

    Any help would be more than welcomed.

    Best
     
  2. jcsd
  3. Sep 24, 2011 #2

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    You can shift the interval [-1, 1] up to [0, 2] and then scale it.
     
  4. Sep 24, 2011 #3
    Thanks... I need some caffeine.
     
  5. Sep 25, 2011 #4

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    In my time zone it was 03:45 AM when you said that, so I'd say you need some sleep. But I guess caffeine will do too :)
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook