I am looking for the numerical approximation of error function, which must be efficient and accurate. Thanks in advance $$\mathrm{erf}(z)=\frac2{\sqrt\pi}\int_0^z e^{-t^2} \,\mathrm dt$$
2026-04-13 16:17:39.1776097059
On
efficient and accurate approximation of error function
7.8k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
There are 3 best solutions below
0
On
In terms of approximation, I think that using $$\text{erf}(x) \sim \sqrt{1-\exp\Big[ -\frac {4x^2} {\pi} P_{n}(x) \Big]}$$ where $P_n$ is the $[2n,2n]$ Padé approximant built around $x=0$ can be very good. For example $$P_1(x)=\frac {1+\frac{\left(10-\pi ^2\right) }{5 (\pi -3) \pi }x^2 } {1+\frac{\left(120-60 \pi +7 \pi ^2\right) }{15 (\pi -3) \pi }x^2 }$$ Computing $$\Phi_n=\int_0^\infty \left(\text{erf}(x)-\sqrt{1-\exp\Big[ -\frac {4x^2} {\pi} P_{n}(x) \Big]}\right) ^2\,dx$$ gives $\Phi_0=3.23\times 10^{-5}$, $\Phi_1=3.04\times 10^{-8}$, $\Phi_2=1.20\times 10^{-10}$, $\Phi_3=3.97\times 10^{-12}$.
"Efficient and accurate" is probably contradictory... Have you tried the one listed in http://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions ?