1
$\begingroup$

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.

Any advice appreciated.

  • 0
    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?2012-03-04

1 Answers 1

1

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]$

  • 0
    Multiplication is in general interpreted to have a higher precedence over addition; so your first multiply the two right-hand side terms.2011-12-05