1
$\begingroup$

So I've been playing with what seems to me to be a pretty simple function, constructed as follows:

$f(0)=\frac{1}{2}$

$f(n+1)=f(n)+\frac{1-f(n)}{2}$ for $n\gt0$

$f(n-1)=\frac{f(n)}{2}$ for $n\lt0$

More generally, $f$ starts midway between two boundaries. With each increment of $x$, starting at zero, the distance to the upper boundary is halved. With each decrement of $x$, starting at zero, the distance to the lower boundary is halved.

Or another way:

$f(x) = 2^{x-1}$ for $x \lt 0$

$f(x) = 1 - 2^{-x-1}$ for $x \ge 0$

This draws a nice S-shaped curve between $0$ (at $x=-\infty$) and 1 (at $x=\infty)$. I'm looking for a single unified way of expressing this function, preferably one that intuitively follows from the construction of the function.

I'm searching for a process more than an answer. It's unclear to me how to jump from the definitions above to a unified definition of $f(x)$ -- I'm not looking for answers in the class of "Oh well this is just a sigmoid function with the following parameters...", I'm looking for a way to jump from the intuitive definition to a formula.

In other words, how do I translate "$f(x)$ starts in the middle and each step forward/backward halves the distance to the upper/lower boundary" into a mathematical formula?

$\endgroup$
2
$\begingroup$

$$f(x)=\begin{cases}2^{x-1}&\text{if }x\lt 0,\\1-2^{-x-1}&\text{if }x\ge0\end{cases}$$ is just fine as a function definition.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Sure -- but is their a unified equation for the function? It feels like there should be. $\endgroup$ – Nate Jun 12 '13 at 6:54
  • $\begingroup$ @Nate: Is there a unified equation for $f(x)=|x|$? Do think expressions such as $f(a,b)=\frac{a+b+|a-b|}{2}$ are somehow more useful than $f(a,b)=\max\{a,b\}$? Or is $f(x)=\lim_{n\to \infty}\lim_{m\to\infty}\cos^{2m}(n\pi x)$ somehow more comprehensible that $f(x)=\begin{cases} 1&\text{if }x\in\mathbb Q\\0&\text{otherwise}\end{cases}$? $\endgroup$ – Hagen von Eitzen Jun 15 '13 at 21:24
  • $\begingroup$ My confusion was rooted in the fact that the function is not continuously differentiable. Now I feel silly. $\endgroup$ – Nate Jun 17 '13 at 20:41
1
$\begingroup$

You can't do that, silly. The function described above is continuous and once-differentiable, but it's not twice-differentiable. It is S-shaped, but it's not a sigmoid function. You can't cleanly generate that function in one sweep.

For context: I had stumbled onto the function, quickly verified that it was continuous and differentiable, thought that I had found an interesting derivation of sigmoid functions. However, I couldn't get from my simple bipartite formulae to a function of the form $\frac{1}{1+e^{\phi x}}$. I thought this was due to my own inability to manipulate the formulas. It took me an embarrassingly long time to realize that the described function isn't continuously differentiable.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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