0
$\begingroup$

What is the function f(x)= that produces these discrete values:

input   output [0-1500]     13 ]1500-3000]  12 ]3000-6000]  11 ]6000-12000] 10 ..... 

Update: sorry for the lack of precision at the interval limits. Updated. Could you update your answers accordingly?

Thanks

  • 0
    Do $y$ou want a continuous function? If not, you can use step function.2012-08-27

2 Answers 2

0

It can be computed as $x \mapsto \begin{cases}13 & 0 < x < 1500 \\ 13 - \left\lceil \log_2(\frac{x}{1500}) \right\rceil & x \ge 1500 \end{cases} $

1

Assuming the endpoints of the interval belong to the set of smaller numbers, so that $f((1500,3000]) = \{12\}$ and $f(1500) = 13$ , I'd use $ f(x) = \begin{cases} 13 & x \le 1500~~, \\ 13 - \left\lceil \log_2 \frac{x}{1500} \right\rceil & \text{else}. \end{cases} $ To implement the log, you can use $ \frac{\log x - \log 1500}{\log 2} $ . To switch the endpoints to the other interval, use a floor instead of a ceiling.

  • 0
    @NicolasCadilhac Updated the answer as requested. Hope it works out for you!2012-08-27