Rescaling Data Set: Solve Math Question for Physics Lab

  • Thread starter Thread starter fishingspree2
  • Start date Start date
  • Tags Tags
    Data Set
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
fishingspree2
Messages
138
Reaction score
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?
 
Physics news on Phys.org
The relation you mention is not a linear one.

Moreover, you have not limited the values for A and B.
This means that an A-B of minus infinity must be mapped to S = +100,
that an A-B of plus infinity must be mapped to S = -100,
and that an A-B of zero must be mapped to S = 0.

You could do this for instance with:

[tex]S = -100 \frac {2} {\pi} \arctan(A-B)[/tex]