0
$\begingroup$

I've been checking out a few answers (this and this) but I cannot come up with the result on my own.

Here is my problem:

I have a value from 0 to 100 that I need to express on a scale from -40 to 40.

Can someone please direct me to a proper formula?

$\endgroup$
1
$\begingroup$

You basically want toe formula for the straight line going through the points $(x_1,y_1)=(0,-40)$ and $(x_2,y_2)=(100,40)$. The formula for this is $$y-y_1=m(x-x_1)$$ where $$m=\frac{y_2-y_1}{x_2-x_1}$$

So in your example, this gives $$m=\frac{80}{100}=0.8\\y+40=0.8x\\y=0.8x-40$$Here, $x$ is your "percentage" value, and $y$ gives you the corresponding value on the scale from $-40$ to $40$.

$\endgroup$
  • 1
    $\begingroup$ Thanks, the first comment actually helped me coming to this conclusion but I will mark this as accepted answer to close this question. Thanks for your time. $\endgroup$ – Eric May 24 at 13:18
1
$\begingroup$

A somewhat different way of looking at it. You want to change from a scale that has a range of $100$ to a scale that has a range of $80$, so multiply by $.8$. Then you want to move the origin of the scale from $0$ to $-40$, so subtract $40$. This gives $$y=.8x-40.$$

This works so simply because the original origin is $0$ and it doesn't change when you multiply by $.8.$ If the original scale ran from $20$ to $120$, we would still multiply by $.8$, but now the origin would have moved to $16$, so we would subtract $56$, not $60.$

$\endgroup$
  • $\begingroup$ Thank you for this alternate answer $\endgroup$ – Eric May 24 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.