Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
What do you mean by "greater control over the range produced"? Why not just use a range from 0 to 1 and carry more digits of accuracy? I think a score of "0.851 out of 1" is much clearer than "2.4 on a scale of 1.0 to 3.0". –  Austin Mohr Dec 5 '11 at 1:50
    
@AustinMohr It's not a person who is evaluating the score, its another program, and that program requires a score within said range. –  markdsievers Dec 5 '11 at 7:14
    
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

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

share|improve this answer
    
Multiplication is in general interpreted to have a higher precedence over addition; so your first multiply the two right-hand side terms. –  Kavka Dec 5 '11 at 1:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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