2

The error function is defined by,

$$\operatorname{erf}(x) = \frac{2}{\sqrt{\pi}}\int^{x}_{0}e^{-t^2} dt$$

I started by determining the Taylor polynomial of degree $2n$ around $x=0$ of $e^{-x^2}$. For this I used the Taylor expansion of $e^t$, which has an infinite range of convergence, and made a substitution $t=-x^2$ (here $x=0 \implies t=0$ so it is centered around the same point). This gives

$$T_{2n}(x)=\sum^{2n}_{k=0} \frac{(-x^2)^k}{k!}=\sum^{2n}_{k=0} (-1)^k\frac{x^{2k}}{k!}$$

Next I wanted to determine an upper bound for the error of this approx. ($f(x)=e^{-x^2}$),

$$|f(x)-T_{2n}(x)| = \left|\frac{f^{2n+1}(\xi)}{(2n+1)!}x^{2n+1}\right|$$

Then I proved this recurrence relation for the derivatives of $f$ (which I will denote by $F_n$),

$$F_n=-2xF_{n-1}-2(n-1)F_{n-2}$$

Now because $F_1(0)=0$ this recurrence relation shows that all odd $F_n(0)=0$. But what I wanted to do was find the max value of $F_{2n+1}$ over a given interval $[0,x]$. To do this I take the derivative of $F_{2n+1}$ which is $F_{2n+2}$ and for the max. value,

$$F_{2n+2}=0$$

Using the recurrence relation

$$-2xF_{2n+1}-2(2n+1)F_{2n}=0$$ $$F_{2n+1}=\frac{2n+1}{-x}F_{2n}$$

For some $x$. I tried simplifying this further using the recurrence relation to obtain an expression of the form $F_1=\dots F_0$, but this wasn't easy to evaluate. I decided to plot the derivatives using Desmos, and I saw that all even $F_n$ had a max. at $x=0$. But $(2n+1)$ is odd, so $x=0$ cannot be a solution. What I also see is that the max value of $F_{2n+1}$ approaches $x=0$ for higher derivatives. This would make sense since the fraction in the expression also gets larger for $x\to 0$.

But I'm stuck trying to find an actual expression... I think finding an expression for the even derivatives might be the way to go. Can anyone help me?

Desmos plot

Gary
  • 31,845
gordon
  • 95
  • 1
    You have an alternating series, and for sufficiently large $k>x^2$ it is clear that the terms will decrease. At that point an elementary result is that the error is bounded by the first missing term. Do you need a sharper bound than that? – obscurans Mar 14 '23 at 06:59
  • @gordon Did any of us answer your question? – Gary Mar 16 '23 at 06:09

2 Answers2

2

The substitution $t = u^{1/2}$ leads to $$ \operatorname{erf}(x) = \frac{1}{{\sqrt \pi }}\int_0^{x^2 } {{\rm e}^{ - u} u^{ - 1/2} {\rm d}u} . $$ Now, by Taylor's theorem with integral remainder, $$ {\rm e}^{ - u} = \sum\limits_{n = 0}^N {( - 1)^n \frac{{u^n }}{{n!}}} + ( - 1)^{N + 1} \frac{{u^{N + 1} }}{{N!}}\int_0^1 {{\rm e}^{ - ut} (1 - t)^N {\rm d}t} $$ for any real $u$ and $N\ge 0$. Therefore, \begin{align*} \operatorname{erf}(x) = \frac{2}{{\sqrt \pi }}\sum\limits_{n = 0}^N {\frac{{( - 1)^n }}{{2n + 1}}\frac{{x^{2n + 1} }}{{n!}}} + \frac{1}{{\sqrt \pi }}\frac{{( - 1)^{N + 1} }}{{N!}}\int_0^{x^2 } {u^{N + 1/2} \int_0^1 {{\rm e}^{ - ut} (1 - t)^N {\rm d}t}\, {\rm d}u} . \end{align*} Since $0 < {\rm e}^{ - ut} < 1$ whenever $0<t<1$ and $0<u<x^2$, by the mean value theorem of integration, the remainder is $$ \frac{1}{{\sqrt \pi }}\frac{{( - 1)^{N + 1} }}{{N!}}\theta _N (x)\int_0^{x^2 } {u^{N + 1/2} \int_0^1 { (1 - t)^N {\rm d}t}\, {\rm d}u}= \theta _N (x)\frac{2}{{\sqrt \pi }}\frac{{( - 1)^{N + 1} }}{{2N + 3}}\frac{{x^{2N + 3} }}{{(N + 1)!}} $$ with a suitable $0<\theta _N (x)<1$. In summary, $$ \operatorname{erf}(x) = \frac{2}{{\sqrt \pi }}x\!\left( {\sum\limits_{n = 0}^N {\frac{{( - 1)^n }}{{2n + 1}}\frac{{x^{2n} }}{{n!}}} + \theta _N (x)\frac{{( - 1)^{N + 1} }}{{2N + 3}}\frac{{x^{2N + 2} }}{{(N + 1)!}}} \right) $$ for any real $x$ and $N\ge 0$, with a suitable $0<\theta _N (x)<1$.

Gary
  • 31,845
1

Doing the same, you must introduce the incomplete gamma function to obtain $$\frac{f(x)-T_{2n}(x)}{f(x)}=1-\frac{\Gamma \left(2 n+1,-x^2\right)}{\Gamma (2 n+1)}$$ $$\frac d {dx} \big[f(x)-T_{2n}(x)\big]=-\frac{2 e^{-x^2} x}{\Gamma (2 n+1)} \left(e^{x^2} x^{4 n}+\Gamma (2 n+1)-\Gamma \left(2 n+1,-x^2\right)\right)$$ Then, for a given $n$, we need to find the zero of function $$g(x)=e^{x^2} x^{4 n}+\Gamma (2n+1)-\Gamma \left(2 n+1,-x^2\right)$$

If there is any, this would be a (tedious) numerical work.