- #1
fishingspree2
- 139
- 0
Hello, this is not really a math homework but I have a math question for a physics lab.
Let's say I have two numbers A and B which are both more or equal to 0.
Then, A-B is always in the interval [-B,A].
I want to assign the difference A-B to number S in an interval [-100,100], in such a way that if A = 0, A-B = -B and the scaled value S is 100, and if B=0, A-B=A and the scaled value is S = -100. Finally, if A-B = 0 then S = 0. Any other difference is scaled on the interval [-100 , 100].
First, I tried this: for difference = -B, then S=100
for difference = A, S=-100
for difference = 0, S=0
I have set up a linear equation using slope 100+100/-B-A = -200/(A+B).
Therefore, S = [-200/(A+B)]*difference = [-200/(A+B)]*(A-B)
Then, for any value A and B > 0, it should give me an S between [-100,100], but this does not work. I have no idea why.
Can anyone please point me towards the right direction?
Let's say I have two numbers A and B which are both more or equal to 0.
Then, A-B is always in the interval [-B,A].
I want to assign the difference A-B to number S in an interval [-100,100], in such a way that if A = 0, A-B = -B and the scaled value S is 100, and if B=0, A-B=A and the scaled value is S = -100. Finally, if A-B = 0 then S = 0. Any other difference is scaled on the interval [-100 , 100].
First, I tried this: for difference = -B, then S=100
for difference = A, S=-100
for difference = 0, S=0
I have set up a linear equation using slope 100+100/-B-A = -200/(A+B).
Therefore, S = [-200/(A+B)]*difference = [-200/(A+B)]*(A-B)
Then, for any value A and B > 0, it should give me an S between [-100,100], but this does not work. I have no idea why.
Can anyone please point me towards the right direction?