2

The hyperbolic tangent is almost linear around the origin.

I'm looking for a way to modify the tanh function in order to have a bigger almost-linear zone while keeping the asymptote to y = 1. In other words, the function should 'leave' later the y = x straight line and approach sooner the y = 1 straight line, coming closer to the (1, 1) point. (think about "sooner" and "later" as if x was a time variable).

I'd like this 'linearity control' to be a parameter. If useful, feel free to ignore what happens for x < 0.

Thanks for any suggestion!

Claudio
  • 123

2 Answers2

3

One function that works is $\sqrt[a]{tanh(x^a)}$ for a real parameter $a$. The higher the value of $a$, the wider the "linear-looking" area around $x=0$. Unfortunately for negative values of $x$ it is required that $a$ is a rational number in lowest terms, with both an odd numerator and denominator (that is, if you wish to have outputs in the real numbers).

Animation:

Oppenede
  • 546
0

You need to increase the value of $a$ in $\tanh(ax)$.

Let $f(x) = \tanh(2x)$. This squishes $\tanh(ax)$ by a factor of $2$. Since $\tanh x \approx 1$ for $x < -1$ and $x > 1$, then the change in the $y$ values won't be too noticeable.

Here is a Desmos graph of the function.

Toby Mak
  • 16,827