Evaluate,
$$\dfrac{1}{\sqrt{2\,\pi}}\int_{-\infty}^{0.5365}e^{-x^2/2}\,dx$$
In other words, how do I find $N (0.5365)$, where $N(x)$ denotes the $cdf$ of the standard normal random variable?
Evaluate,
$$\dfrac{1}{\sqrt{2\,\pi}}\int_{-\infty}^{0.5365}e^{-x^2/2}\,dx$$
In other words, how do I find $N (0.5365)$, where $N(x)$ denotes the $cdf$ of the standard normal random variable?
You can make a series expansion for $e^{-x^2/2}$ at $x=0$:
$$e^{-x^2/2}=1-\frac{x^2}{2}+\frac{x^4}{8}-\frac{x^6}{48}+\frac{x^6}{484}-\ldots$$
We want the integral
$$\int_0^x e^{-t^2/2} \,dt=\frac{x}{\color{blue}1\cdot 1}-\frac{x^3}{\color{blue}2\cdot 3}+\frac{x^5}{\color{blue}8\cdot 5}-\frac{x^7}{\color{blue}{48}\cdot 7}+\frac{x^9}{\color{blue}{384}\cdot 9}-\ldots$$
Without the blue factors the series is
$$\sum_{k=0}^{\infty} (-1)^k\frac{x^{2k+1}}{2k+1}$$
A formula for the sequence $1,2,8,48,484,..$ can be found using OEIS. The result is $2^k\cdot k!$. Therefore $$\int_0^x e^{-t^2/2} \,dt=\sum_{k=0}^{\infty}(-1)^k\frac{x^{2k+1}}{(2k+1)\cdot 2^k\cdot k!}$$
And finally
$$\frac1{\sqrt{2\pi}}\int_{-\infty}^x e^{-t^2/2} \,dt=\frac12+\frac1{\sqrt{2\pi}}\cdot \sum_{k=0}^{\infty}(-1)^k\frac{x^{2k+1}}{(2k+1)\cdot 2^k\cdot k!}$$
If $x=0.5365$, already for $k=3$ one gets a good approximation since the approximated value is 0.704193, which is identical to the result of the online calculator.
If you look at the definition of the error function, you will easily understand that $$I(a)=\dfrac{1}{\sqrt{2\,\pi}}\int_{-\infty}^{a}e^{-x^2/2}\,dx=\frac{1}{2} \left(1+\text{erf}\left(\frac{a}{\sqrt{2}}\right)\right)$$ The Wikipedia page also gives the Taylor expansion of it $$\operatorname{erf}(z)= \frac{2}{\sqrt{\pi}}\sum_{n=0}^\infty\frac{(-1)^n z^{2n+1}}{n! (2n+1)} =\frac{2}{\sqrt{\pi}} \left(z-\frac{z^3}{3}+\frac{z^5}{10}-\frac{z^7}{42}+\frac{z^9}{216}-\ \cdots\right)$$ Using it, you then have $$I(a)=\frac{1}{2}+\frac{a}{\sqrt{2 \pi }}-\frac{a^3}{6 \sqrt{2 \pi }}+\frac{a^5}{40 \sqrt{2 \pi }}-\frac{a^7}{336 \sqrt{2 \pi }}+\frac{a^9}{3456 \sqrt{2 \pi }}+O\left(a^{11}\right)$$ Using it for different values of $n$ and $a=0.5365$, you would get $$\left( \begin{array}{cc} n & I(0.5365) \\ 0 & 0.7140325334 \\ 1 & 0.7037649558 \\ 2 & 0.7042082568 \\ 3 & 0.7041930668 \\ 4 & 0.7041934919 \\ 5 & 0.7041934818 \\ 6 & 0.7041934820 \end{array} \right)$$ If you prefer not to use series expansion, look at this post where are proposed two rather simple approximations $$\mathrm{erf}\!\left(X\right)\approx \sqrt{1-\exp\Big(-\frac {4X^2} {\pi} \Big)}\tag 1$$ $$\mathrm{erf}\!\left(X\right)\approx\sqrt{1-\exp\Big(-\frac 4 {\pi}\,\frac{1+\alpha\, X^2}{1+\beta\, X^2}\,X^2 \Big)}\tag 2$$ where $$\alpha=\frac{10-\pi ^2}{5 (\pi -3) \pi }\qquad \text{and}\qquad \beta=\frac{120-60 \pi +7 \pi ^2}{15 (\pi -3) \pi }$$ Approximation $(1)$ would give $0.704592$ and approximation $(2)$ would give $0.704193$.
I use Simpson's Method to compute such function. There is no analytic exact solution to this integral.
pnorm(0.5365)
. – Em. Apr 08 '17 at 03:33normcdf
. If all you have is a C compiler that supports the ISO C99 specification, take a look at my answer to this question – njuffa Apr 08 '17 at 07:09