Q:

What is X if position value is between 0 and 500 and I need it has -1 to 1?

Let's say I have a line from 0 to 500, and I'd like to know in which position a point is from -1 to 1, where centre is 250, how can I do that ? Any suggestions ? Thanks!
So far this is what I've tried, with some help I found online:
$a \cdot 0 + b = -1$
$a \cdot 500 + b = 1$
Results:
$a = 0.004$ and
$b = -1$.
But not sure how to plug this in to find a random value of X, such as let's say for 250 that should be 0. Any suggestions are appreciated!

A:

To go from $x\in [0,500]$ to $y \in [-1,1]$, use
$$y = x/250-1$$
and the other way use
$$x = 250(y+1)$$

