0

How to transform the $\tanh$ sigmoid function so that it starts from $f(0)=0$, goes asymptotically to $1$, and has $f(0.1)=a$ and $f(0.9)=b$?

Is it possible with that function at all?

Blue
  • 83,939
  • If by "transform" you mean apply an affine transformation to the argument of $f$ and its value, then it's not possible except for special values of $(a,b).$ The conceptual reason is that these transformations form a three-dimensional group but you are imposing four independent conditions on $f.$ Could you therefore please specify what you mean by "transform"? – whuber Jan 30 '20 at 14:20
  • @whuber I am sorry, your comment is too high level for me, I do not understand it, but I am very grateful for it. I use s-curves for practical application. I am in a search for s-curves with certain properties which allow for defining a priori s-curve parameters in reasonable ranges. – Przemyslaw Remin Feb 18 '20 at 10:50

2 Answers2

2

Starting from $$f(x)=p+q\tanh (rx+s)$$with $$\tanh(u)={e^{2u}-1\over e^{2u}+1}$$we obtain $$q,r>0$$ $${p+q=1\\p+q\tanh(s)=0\\ p+q\tanh(0.1r+s)=a\\ p+q\tanh(0.9r+s)=b\\ }$$which leaves us with a bunch of non-analytically solvable equations that should be coped numerically.

Mostafa Ayaz
  • 33,056
  • In general there are no solutions to these equations. – whuber Jan 30 '20 at 15:39
  • So TANH does not take part in the s-curves competition, which could be defined with interpretable parameters as defined in this question?https://math.stackexchange.com/q/3542734/624901 – Przemyslaw Remin Feb 18 '20 at 10:40
1

I understand that you want $$\lim_{t\to-\infty}f(t)=0,\quad f(0.1)=a,\quad f(0.9)=b,\quad \lim_{t\to\infty}f(t)=1\ .$$ The limit conditions can be fulfilled with $$f(t)={1+\tanh\bigl(c(t-t_0)\bigr)\over2},\quad c>0,\quad t_0\in{\mathbb R}\ .$$ The parameters $c$ and $t_0$ adjust the time scale and have to be chosen such that your numerical data are met. This should be possible for arbitrary values $0<a<b<1$.

We obtain the equations $$\eqalign{\tanh\bigl(c(0.1-t_0)\bigr)&=2a-1 \cr \tanh\bigl(c(0.9-t_0)\bigr)&=2b-1\ , \cr}$$ or $$\eqalign{c(0.1-t_0)&={\rm artanh}(2a-1) \cr c(0.9-t_0)&={\rm artanh}(2b-1)\ . \cr}$$ The RHSs of the last equations are known real numbers. It is then easy to find $c$ and $t_0$. Note that the inverse of $\tanh$ can be calculated by $${\rm artanh}(t)={1\over2}\log{1+t\over1-t}\qquad(-1<t<1)\ .$$