1

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

Peter
  • 161
  • 1
    Once you know the function from above of your drawing, call it $f$. Chose the function from bellow of your drawing to be $g(x)=-f(-x)$. It seens to be that $f_t(x)$ should be the concatenation of $H(t,x)=(1-t)f(x)+tx$ and $G(t,x)=(1-t)x+tg(x)$. $H$ deforms $f$ on the identity and $G$ deforms the identity on $g$. You may need to do some rescaling on the parameter $t$ to get $f_0(x)=x$. – Ygor Arthur Mar 27 '23 at 22:34
  • I think it would be easier to consider the inverse function, which would have $g(0)=t$ instead of $f(t)=0$. – mr_e_man Mar 28 '23 at 01:29

4 Answers4

1

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.

  • Thanks for the answer. However, looking into this, it looks like for any value of t, $f_t(x)$ is quadratic in x. I don't see how this can work. E.g. suppose t=0.99. How can any quadratic fit (-1, -1), (0.99, 0), (1, 1) while being monotonic for all $x\in[-1, 1]$. – Peter May 23 '23 at 20:59
  • Hi @Peter, I am not sure if I understood the problem. For any $t$, $f_t'(x)>0$ for all $x\in[-1,1]$, so it is increasing in this interval. I don't know if I am missing something. – Ygor Arthur May 25 '23 at 16:16
  • Indeed, if you draw the graph of $f_{0.99}(x)$ you should get something like the reflection by the $y=x$ line of the graph above. – Ygor Arthur May 25 '23 at 16:19
  • It will not be monotonic in [-1, 1]: https://www.google.com/search?q=49.74874371859289x%5E2%2B+x+-49.74874371859289&oq=49.74874371859289x%5E2%2B+x+-49.74874371859289&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCDkxMTRqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8 – Peter May 25 '23 at 16:39
  • Hi @Peter, it may be an error in calculations with a computer. Look, for $t\in(1/2,1]$ we have $f_t(x)=G(2t-1,x)=(2-2t)x+(2t-1)g(x)$, so $f_t'(x)=(2-2t)+(2t-1)g'(x)=(2-2t)+(2t-1)\frac{2(x+1)+1}{3} >0$. Thus it is increasing for all $t\in(1/2,1]$, in particular for $t=0.99$ – Ygor Arthur May 26 '23 at 01:01
1

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

Ethan Bolker
  • 103,433
  • I don't see how the solution can have the form of a circle. Take the case where t=0.90. Imaging drawing a circle that passes through (-1, -1), (0.99, 0), and (1, 1). It - it would not be monotonically increasing. – Peter Mar 27 '23 at 23:49
  • 1
    @Peter Right you are,. Sorry. I think you can solve your problem with a superellipse. I may work it out. – Ethan Bolker Mar 27 '23 at 23:59
1

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.

daisies
  • 2,063
  • 2
  • 7
  • Thank you for this - the superellipse inspired me to look for solutions of the (asymmetric) form $f(x)=2*((x+1)/2)^p-1$, which led to a working (symmetric) answer with a closed-form solution, which I think is a superellipse when you crunch it all down. – Peter May 24 '23 at 03:47
0

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.

Peter
  • 161