0
$\begingroup$

Maximum input to function is $40$, minimum is $1$. Function works like this:

$f(40)=0.2$,
$f(1)=1$

we also want to know what $f(x)$ would produce. The answer would be "linear" to these two cases - for example, $f(20)$ would return something around $0.6$.

Can someone help me with this function?

  • 1
    http://en.wikipedia.org/wiki/Linear_equation#Two-point_form2012-04-15

3 Answers 3

1

If $f$ is linear then $f(x)=ax+b$ for some $a,b$. Plug in the values $x=1$ and $x=40$ to obtain $a$ and $b$.

  • 0
    Thank you, this is the first, the shortest and the most universal answer and that's why I've chosen it. I'd like to thank the other two participants as well.2012-04-15
1

Since $f(1)=1$ and $f(40)=0.2$, and you want the function be linear, the output must decrease by $1-0.2=0.8$ units for every $40-1=39$ units of increase in the input. Therefore the output must decrease by $\dfrac{0.8}{39}$ units for every increase of $1$ in the input, and we have $f(x)=1-\frac{0.8}{39}(x-1)=1-\frac8{390}(x-1)=1-\frac4{195}(x-1)\;.$ If you want, you can simplify this to $f(x)=\frac1{195}(199-4x)\;.$

  • 0
    Thank you for your straightforward answer.2012-04-15
1

For linear $f$ we have $f(x) = a\cdot x + b$, so $0.2 = a \cdot 40 + b$ and $1 = a \cdot 1 + b$. Solving this set of equations we have that $a = \frac{-4}{195} = -0.0205128$ and $b = \frac{199}{195} = 1.02051$.

Hope that helps ;-)