Converting Negative to Positive: Transforming -1 to 1 into 0 to 1 in Java

  • Thread starter Thread starter bitttttor
  • Start date Start date
  • Tags Tags
    Change
Click For Summary

Homework Help Overview

The discussion revolves around transforming a numerical evaluation factor 'a' that ranges from -1 to 1 into a new factor 'b' that ranges from 0 to 1. The original poster expresses difficulty in understanding the mathematical transformation required for this conversion.

Discussion Character

  • Exploratory, Mathematical reasoning

Approaches and Questions Raised

  • Some participants suggest shifting the interval from [-1, 1] to [0, 2] and then scaling it to achieve the desired range. The original poster seeks clarification on the mathematical process involved.

Discussion Status

The conversation includes attempts to clarify the mathematical transformation. While some guidance has been offered regarding shifting and scaling, the original poster still expresses uncertainty about the math involved.

Contextual Notes

The original poster mentions needing to compute with other factors, indicating that the transformation is part of a larger application context. There is also a light-hearted exchange regarding the time of day and the need for caffeine, which reflects the informal nature of the discussion.

bitttttor
Messages
11
Reaction score
0
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
 
Physics news on Phys.org
You can shift the interval [-1, 1] up to [0, 2] and then scale it.
 
CompuChip said:
You can shift the interval [-1, 1] up to [0, 2] and then scale it.

Thanks... I need some caffeine.
 
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 :)
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
Replies
1
Views
1K
  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 69 ·
3
Replies
69
Views
9K
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
Replies
3
Views
2K