Smooth monotonic function $f: [-1, 1] \to [-1, 1]$

144 Views Asked by At

I'm looking for a function $f_t: [-1, 1] \rightarrow [-1, 1]$ parameterized by a "threshold" $t\in(-1, 1)$ that meets the following constraints:

  1. $f_t(x)$ is smooth and monotonically increasing in $x \in [-1, 1], \forall t \in (-1, 1)$
  2. $f_t(-1)=-1$, $f_t(1)=1, f_t(t)=0$, $\forall t \in (-1, 1)$
  3. $f(x)_{t=0}=x$

What is the right functional form here? Thoughts so far...

  • Quadratic is out - it can satisfy (2) but is not monotonic for all t
  • Cubic could work - but there are 4 parameters and only 3 constraints.

Keywords (because I can't add tags) Soft threshold, sigmoid, nonlinearity

enter image description here

4

There are 4 best solutions below

0
On BEST ANSWER

Ok, got it. Idea is to remap our domain and range from [-1, 1] to [0, 1], and note that, using the functional form $f(x) = x^p$, you can remain monotonic while passing through (0, 0), (t, 0.5), and (1, 1), for any $t \in (0, 1)$. Solving for $p$ gives us:

$$ g_t(x) = x^{-\log(2)/\log(t)} $$

Which looks like an asymmetric onion:

enter image description here

This alone would be fine to satisfy the constraints. (We just need to remap domain and range from $[0, 1]$ to $[-1, 1]$). But we can make it a bit "nicer" by adding symmetry about the diagonal, by averaging the function with a mirror-image of itself:

$$ h_t(x) = (g_t(x)+1-g_{1-t}(1-x))/2 $$

And finally, remapping to [-1, 1] with

$$ f_t(x) = 2 h_{(t+1)/2}((x+1)/2)-1 $$

enter image description here

See colab notebook

I suspect this is equivalent to the superellipse solution mentioned by other commenters.

Update - this function can be generalized to have a "steepness parameter" controlling how steep it is in the middle (and causing it to saturate at the ends). See this post.

5
On

I will do it by construction. By doing some brutal force trying on finding some function with this conditions, it seems that $g(x)=((x+1)^2+(x+1)-3)/3$ may work as your "function from bellow". It's graph looks like

enter image description here

Then, define the function from above as $f(x)=-g(-x)$.

Now consider the functions $H(t,x)=(1-t)f(x)+tx$ and $G(t,x)=(1-t)x+tg(x)$.

Finally, define $f_t(x)$ by $f_t(x)=H(2t,x)$, for $t\in [0,1/2]$ and $f_t(x)=G(2t-1,x)$, for $t\in(1/2,1]$. Then you can do any rescalling you want to get $f_0(x)=x$ (in this case we actually got $f_{\frac{1}{2}}(x)=x$.

Notice that for any $t$, the function $f_t(x)$ is smooth, because it is sum of smooth functions.

2
On

You can do this with a superellipse. $$ x^a + y^a = 1 $$ connects $(1,0)$ to $(0,1)$ and crosses the diagonal between $(0,0)$ and $(1,1)$ nearer to $(1,1)$ as $a$ grows.

Translate that to get what you need.

Here's a Desmos picture:

enter image description here

1
On

Here is a slightly unsatisfying brute forced answer; it will fulfill all of your requirements but is not totally expressible in elementary functions. Set $$ f_t(x) =2 \left(\left(1-\left(-\frac{1}{2}x+\frac{1}{2}\right)^{g^{-1}(t)}\right)^{\frac{1}{g^{-1}(t)}}-\frac{1}{2}\right) $$ where $g(s) = -2\left(\left(1-\frac{1}{2^{s}}\right)^{\frac{1}{s}}-\frac{1}{2}\right)$.

This solution works for all $t \in (-1, 1)$, and in fact has the "correct" limiting behaviour at $t \to \pm 1$, and gives curves that are symmetric in $t$ (e.g. $f_t$ is just $f_{-t}$ reflected), and smoothness is apparent from the smoothness of $g$ and the inverse function theorem.

Note that this is just a (quadrant of a) superellipse reparameterized to fit your criteria.