# How to control the range in a reciprocal function

Given the reciprocal function $$\frac{a}{m \cdot x + b}$$ where $a,m,b$ are constants. I'm trying to figure out how/if I can control the range that this produces. The application of this problem is generating a "score" based on a locations' proximity to me. So for example, in my problem I know the range of possible values is $0$-$100$ km, I need to build a score between $1.0$ and $3.0$ where a proximity of $0$ km (i.e., very close) would generate a score closer to $3.0$ and a distance of $100$ km (i.e., very far away) would generate a score closer to $1.0$.

I was previously using this successfully to produced a range of $0$-$1.0$, but it turned out that I need greater control over the range produced.

• Are you trying to find $a$, $m$, and $b$ so that you get the desired range, or do you have them already fixed and want to postprocess the output of the function to make it fit within the range? – Rahul Mar 4 '12 at 6:04
Let $f(x) = \dfrac{a}{mx+b}$. Then for a score between the bounds $s_l$ (corresponding to $f(100)$) and $s_u$ (corresponding to f(0)), you can write:
$s(x) = s_u + \left[ (s_l-s_u) \cdot \dfrac{f(x)-f(0)}{f(100)-f(0)} \right]$