Declaration of cumulative distribution function

I have a code that illustrates a certain figure.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}[
declare function={ Nprime(\x)                 = 1/(sqrt(2*pi))*exp(-0.5*(pow(\x,2)));
d2(\x,\y,\KK,\RR,\SIG)     = (ln(\x/\KK)+(\RR-(pow(\SIG,2)/2)*\y))/(\SIG*(sqrt(\y)));
myfun(\x,\y,\KK,\RR,\SIG)  = exp(-\RR*\y)*Nprime(d2(\x,\y,\KK,\RR,\SIG))/(\x*\SIG*sqrt(\y));
},
]
\begin{axis}[y domain=0.01:0.3,domain=95:105,view={150}{20}]
\end{axis}
\end{tikzpicture}

\end{document}

Instead of Nprime(\x) I would like to declare and integrate a cumulative distribution function `N(\x). A very close approximation of cumulative distribution function would also be fine. Everything else should remain equal. Does anybody know how to do it? Thanks in advance!!! Here is the formula: enter link description here Something similar is provided here enter link description here but I dont know how to integrate is according to my needs :(

Here is a modified version that doesn't work. The last part of the function, i.e. (\x*\SIG*sqrt(\y)) was removed because it is not needed in this case. Here is the code

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}[
declare function={ normcdf(\x,\m,\s)          = 1/(1 + exp(-0.07056*((\x-\m)/\s)^3 - 1.5976*(\x-\m)/\s));;
d2(\x,\y,\KK,\RR,\SIG)     = (ln(\x/\KK)+(\RR-(pow(\SIG,2)/2)*\y))/(\SIG*(sqrt(\y)));
myfun(\x,\y,\KK,\RR,\SIG)  = exp(-\RR*\y)*normdcf(d2(\x,\y,\KK,\RR,\SIG))
},
]
\begin{axis}[y domain=0.01:0.3,domain=95:105,view={150}{20}]
\end{axis}
\end{tikzpicture}

\end{document}
• Can you also include the function (either the formula or a link) since not everybody here is mathematically specialized? – percusse Aug 1 '13 at 9:46
• @percusse I have edited it, thanks for help! – ajafarov Aug 1 '13 at 11:28
• Well you have the exact code given in the linked question what is the problem? – percusse Aug 1 '13 at 11:31
• @percusse I have difficulties integrating it into the code written by you, that's my problem – ajafarov Aug 1 '13 at 11:46
• What exactly are you trying to plot (myfun and d2 aren't very enlightening function names)? Could you provide a link to a Wolfram Alpha plot of the desired function? – Jake Aug 1 '13 at 13:28

There are three issues in your code:

1. Missing semicolon at the end of the definition of myfun. All functions defined using declare function have to end with a semicolon.
2. Typo in the function name (it's normcdf, not normdcf).
3. Incorrect call of the normcdf function. It takes three parameters: The x value, the mean, and the standard deviation of the normal distribution. \documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}[
declare function={ normcdf(\x,\m,\s)          = 1/(1 + exp(-0.07056*((\x-\m)/\s)^3 - 1.5976*(\x-\m)/\s));
d2(\x,\y,\KK,\RR,\SIG)     = (ln(\x/\KK)+(\RR-(pow(\SIG,2)/2)*\y))/(\SIG*(sqrt(\y)));
myfun(\x,\y,\KK,\RR,\SIG)  = exp(-\RR*\y)*normcdf(d2(\x,\y,\KK,\RR,\SIG),0,1);
},
]
\begin{axis}[y domain=0.01:0.3,domain=95:105,view={210}{20}]