I want to define a continuous function $f(x)$ such that the following properties hold true.
- $f(0) = 1$
- $f(-1) = 1 - 0.5 = 0.5$
- $f(1) = 1 + 0.5 = 1.5$
- $f(-2) = 1 - 0.5 - 0.25 = 0.25$
- $f(2) = 1 + 0.5 + 0.25 = 1.75$
- $f(-3) = 1 - 0.5 - 0.25 - 0.125 = 0.125$
- $f(3) = 1 + 0.5 + 0.25 + 0.125 = 1.875$
- And so on, ad infinitum.
So, I know that I'm looking for some kind of a sigmoid function. My first approximation was to use the hyperbolic tangent.
$$f(x) = 1 + tanh(x)$$
This function ranges from $0$ to $2$, with $f(0) = 1$, just like I want. But, now I'm stuck. How do I scale it to match the function that I want?