3
$\begingroup$

If you plot the functions $$\text{erf}(x)=\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}\mathrm{d}t$$ and $$\frac{2}{\sqrt{\pi}}\tanh(x)=\frac{2}{\sqrt{\pi}}\frac{e^x-e^{-x}}{e^x+e^{-x}},$$ they look very similar and their numeric values are almost the same and a big part of their domain.

Is there a deep reason for this?

$\endgroup$
5
  • 4
    $\begingroup$ I like this question. I'm not sure what answer you are expecting though. Try Taylor series around $x=0$, since the functions are close in value only for small $x$ $\endgroup$ – Yuriy S Aug 15 '16 at 3:07
  • 2
    $\begingroup$ Check this math.stackexchange.com/questions/321569/… $\endgroup$ – dian Aug 15 '16 at 3:09
  • $\begingroup$ At $x=0$ they have the same function value, as well as the same first, second, third, and fourth derivatives. So the @YuriyS explanation works. $\endgroup$ – Michael Aug 15 '16 at 3:27
  • 1
    $\begingroup$ math.stackexchange.com/a/321592/333612 $\endgroup$ – Biggs Aug 15 '16 at 3:41
  • 1
    $\begingroup$ Checking the plots on Wolfram|Alpha shows that the approximation is only any good for something like $\lvert x \rvert < 0.5.$ Beyond that, the approximation gets bad fast. This leads me to believe the explanation by @YuriyS based on Taylor series. Compare this .gif. $\endgroup$ – Will R Aug 15 '16 at 3:54
4
$\begingroup$

Many things have already to told in comments.

Concerning Taylor series, we have $$\text{erf}(x)=\frac{2 x}{\sqrt{\pi }}-\frac{2 x^3}{3 \sqrt{\pi }}+\frac{x^5}{5 \sqrt{\pi }}-\frac{x^7}{21 \sqrt{\pi }}+\frac{x^9}{108 \sqrt{\pi }}+O\left(x^{10}\right)$$

$$\frac{2}{\sqrt{\pi}}\tanh(x)=\frac{2 x}{\sqrt{\pi }}-\frac{2 x^3}{3 \sqrt{\pi }}+\frac{4 x^5}{15 \sqrt{\pi }}-\frac{34 x^7}{315 \sqrt{\pi }}+\frac{124 x^9}{2835 \sqrt{\pi }}+O\left(x^{10}\right)$$ $$\text{erf}(x)-\frac{2}{\sqrt{\pi}}\tanh(x)=-\frac{x^5}{15 \sqrt{\pi }}+\frac{19 x^7}{315 \sqrt{\pi }}-\frac{391 x^9}{11340 \sqrt{\pi }}+O\left(x^{10}\right)$$ On the other hand, $$\lim_{x\to\infty}\text{erf}(x)=1$$ while $$\lim_{x\to\infty}\frac{2}{\sqrt{\pi}}\tanh(x)=\frac{2}{\sqrt{\pi }}$$ On another hand $$2\frac{ \left(\frac{2 \tanh (x)}{\sqrt{\pi }}-\text{erf}(x)\right)}{\text{erf}(x)+\frac{2 \tanh (x)}{\sqrt{\pi }}}<0.01$$ if $x<0.809$.

So, a already said in comments, the functions are "close" to eachother over a quite limited range.

$\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.