1
$\begingroup$

I'm writing an app and I want to present some ratios normalized on a scale of 0 to 10. It's information like (number of issues resolved : number of issues remaining open).

My idea is to write a function, and a few of its inputs & outputs would be:

f(0)   ->  0
f(0.1) ->  1.0
f(1)   ->  5.0
f(10)  ->  9.0
f(inf) -> 10.0

So, the input is a real number >= 0, and the output is a real between 0 and 10 inclusive.

So my immediate question is: Is there a well known formula that would create this kind of output? I got pretty close with some variations of y = a/(1 + be^(-kx)), but I'm mostly randomly guessing.

I'm interested in any way to solve this, as well as how to generate solutions for it.

Also: since I'm programming this, I could do this with a few functions which I alternatively invoke, depending on the input.

EDIT: Here's @A.S.'s solution, y=10*(x/(1+x)) which looks pretty much perfect:

enter image description here

This is my javascript implementation.

$\endgroup$
11
  • $\begingroup$ Can you have more than eleven inputs? $\endgroup$
    – Git Gud
    Dec 19, 2015 at 23:30
  • $\begingroup$ Yes @GitGud the input is a real >= 0, and the output is a real bet. 0 and 10 inclusive. $\endgroup$
    – Dogweather
    Dec 19, 2015 at 23:32
  • 3
    $\begingroup$ $f(x)\approx 10\frac x {1+x}$ $\endgroup$
    – A.S.
    Dec 19, 2015 at 23:37
  • 1
    $\begingroup$ In fact, I'd argue it's THE function you should use since $x\to \frac{x}{1+x}$ is transformation from odds (your input) to probabilities - very meaningful output. $\endgroup$
    – A.S.
    Dec 19, 2015 at 23:42
  • 1
    $\begingroup$ Deleted my question about the nearest integer function. I'm the second person to believe the outputs need be integers for some reason. $\endgroup$
    – Corellian
    Dec 19, 2015 at 23:45

0

You must log in to answer this question.

Browse other questions tagged .