# Solve an equation involving the error function

Let $$0 be given. The equation:

$$a = 1 - \frac{2\sqrt{x/\pi}}{\mathrm e^x \mathrm{erf}(\sqrt x)}$$

has a unique root $$x$$, because the right-hand side is increasing in $$x$$, and goes to $$0,1$$ as $$x\rightarrow 0,\infty$$.

Can we write the root as some analytical expression using special functions? I don't know if this is possible (this is not a textbook exercise). But maybe someone with more experience with error function and related special functions finds a way. Thanks.

• We can define the special function becko(a) to be the root of this. – Ross Millikan Dec 4 '18 at 23:54
• @RossMillikan Well... it would be ideal to express $becko(a)$ in terms of other special functions ;) ... though maybe it's just not possible. – becko Dec 5 '18 at 0:01
• There is just nothing special about special functions except that people call them so. If they come up often enough, they are normal functions like trig ones. If they come up some but not so much they are special functions. And if they come up rarely they don't get called that. The only point is I don't know what counts as a special function. I would be surprised if we could represent this one in terms of others, but many people know more about this than me. – Ross Millikan Dec 5 '18 at 0:49
• @RossMillikan There is something special about special functions in practice (though not in theory of course): People immediately have an intuition for them, and they are usually easy and fast to compute because of the availability of numerical packages. That's all... I'm not surprised if my expression cannot be "simplified". I just wanted to be sure I wasn't missing any obvious reductions. And in this case I can even probably compute $x(\alpha)$ fast using Newton.... I'm not complaining :) – becko Dec 5 '18 at 1:06
• A good example is the Lambert W function. I have no intuition for it. It is reasonably fast to compute because people have worked to find fast ways to compute it. This function would not be slow to get a numeric solution for. You would just need a reasonable starting value which you can probably get from the error function, then let Newton take its course. – Ross Millikan Dec 5 '18 at 1:09

Without special functions, we can have a quite good approximation using a $$[3,3]$$ Padé approximant built at $$x=0$$. This would give $$1 - \frac{2\sqrt{\frac x\pi}}{\mathrm e^x \,\mathrm{erf}(\sqrt x)}=\frac {\frac{2 }{3}x-\frac{8 }{195}x^2+\frac{136 }{15015}x^3 } { 1+\frac{8 }{39}x+\frac{92 }{2145}x^2+\frac{128 }{45045}x^3}$$ which is quite good up to $$a=0.95$$ (corresponding to $$x=4$$.

So, we are left with a cubic equation which has only one real root; so, use the hyperbolic solution. This will give you a reasonable starting value $$x_0$$ for Newton method for the zero of $$f(x)= \frac{2\sqrt{\frac x\pi}}{\mathrm e^x \,\mathrm{erf}(\sqrt x)}+a-1$$

For different values of $$a$$, the table reports the estimate and the solution. $$\left( \begin{array}{ccc} a & \text{estimate} & \text{solution} \\ 0.00 & 0.00000 & 0.00000 \\ 0.05 & 0.07655 & 0.07655 \\ 0.10 & 0.15643 & 0.15643 \\ 0.15 & 0.24000 & 0.24000 \\ 0.20 & 0.32771 & 0.32771 \\ 0.25 & 0.42008 & 0.42008 \\ 0.30 & 0.51775 & 0.51775 \\ 0.35 & 0.62149 & 0.62149 \\ 0.40 & 0.73225 & 0.73225 \\ 0.45 & 0.85123 & 0.85123 \\ 0.50 & 0.97998 & 0.97998 \\ 0.55 & 1.12049 & 1.12050 \\ 0.60 & 1.27551 & 1.27554 \\ 0.65 & 1.44883 & 1.44889 \\ 0.70 & 1.64596 & 1.64611 \\ 0.75 & 1.87540 & 1.87579 \\ 0.80 & 2.15114 & 2.15223 \\ 0.85 & 2.49874 & 2.50207 \\ 0.90 & 2.97220 & 2.98479 \\ 0.95 & 3.71375 & 3.78842 \\ 0.96 & 3.92388 & 4.04257 \\ 0.97 & 4.16667 & 4.36757 \\ 0.98 & 4.44888 & 4.82122 \\ 0.99 & 4.77575 & 5.58700 \end{array} \right)$$

Let us be very pessimistic and consider $$a=0.999$$; the estimate is $$x_0=5.10779$$. Using Newton, the following iterates will be generated $$\left( \begin{array}{cc} n & x_n \\ 0 & 5.10779 \\ 1 & 6.14281 \\ 2 & 7.04987 \\ 3 & 7.71203 \\ 4 & 8.01868 \\ 5 & 8.07151 \\ 6 & 8.07285 \end{array} \right)$$ which is not too bad.

Edit

If we consider that polshing the root of the equation would be necessary, we could think about a simpler estimate.

Looking at the plot of the function, it is very similar to an hyberbolic tangent. So, came the idea of an empirical model $$x = \alpha \left[\tanh ^{-1}\left(\beta\, a^\gamma\right)\right]^\delta$$ Using nonlinear regressions, it became quite clear that $$\beta=\delta=1$$ would be enough.

So, the final model is just $$x = \alpha \tanh ^{-1}\left( a^\gamma\right)$$ which seems to be good $$(R^2=0.999982)$$ and highly significant parameters (as shown below).

$$\begin{array}{clclclclc} \text{} & \text{Estimate} & \text{Standard Error} & \text{Confidence Interval} \\ \alpha & 2.18078 & 0.00213 & \{2.17656,2.18500\} \\ \gamma & 1.22013 & 0.00655 & \{1.20713,1.23312\} \end{array}$$

Update

Looking at the plot of $$\log\left(\frac{2\sqrt{\frac x\pi}}{\mathrm e^x \,\mathrm{erf}(\sqrt x)}\right)$$ it really looks like a power low. Some quite and dirty regression work shows that a reasonable $$(R^2=0.999952)$$ and simpler model could be $$a=1-\exp\left(-\alpha\,x^{\beta} \right)\implies x=\left(-\frac{\log (1-a)}{\alpha }\right)^{\frac{1}{\beta }}$$ $$\begin{array}{clclclclc} \text{} & \text{Estimate} & \text{Standard Error} & \text{Confidence Interval} \\ \alpha & 0.71198 & 0.00030 & \{0.71139,0.71258\} \\ \beta & 1.06896 & 0.00054 & \{1.06789,1.07003\} \\ \end{array}$$

• Thanks! This is very helpful. Since there seems to be no simple special function formula, I'm accepting this as the asnwer. – becko Dec 5 '18 at 14:09