I get 0.986876 instead of the 0.986878 that you report. Recall that I
said that this was an assymptotic series that will not converge, but
could be used for a reasonable approximation when z2 but you have
tried to use it for 1.744196 < 2. It is an alternating series, so
successive sums give you alternately upper an lower bounds. If you stop
the sum at the previous term, you get 0.985848. Thus all you can get
with this assymptotic series is that
0.985848 < erf(1.744196) < 0.986876
which is true, but not a very precise approximation.
Summing through n=18 on Abramowitz & Steguns 7.1.5 (your first formula)
gives 0.986362275 which is correct to 9 figures.
Jerry
Rijan wrote:
Dear Jerry,
Still I could not calculate NORMDIST. Here is my problem again,
NORMDIST(0.3,4,1.5,TRUE)=NORMSDIST((0.3-4)/1.5)=NORMSDIST(-2.46667)=(1-Efr(-(-2.466666)/(SQRT2)))/2=(1-Erf(1.744196))/2
Erf(1.744196)=1-(e^-(1.744196)^2)/(SQRT(pi))*(1/1.744196 €“
(1/2)*(1/(1.744196)^3) + (3/4)*(1/(1.744196)^5) €“
(15/8)*(1/(1.744196)^7)=0.986878
Then with this Erf=0.986878, the NORMSDIST(-2.46667) becomes 0.006560. But
it should be 0.006819. For this result the Erf should be 0.986362 which is
not giving by the above formula.
I have also tried with continued fraction method to calculate Erf which is
as follows.
Erf(1.744196)=1/1.744196+ (1/2)/1.744196+ 1/1.744196+ (3/2)/1.744197+
2/1.744196+ = 0.508553 and this is quite different from the above one.
Would you please let me know what is wrong with the above calculations?
Regards
Rijan
"Jerry W. Lewis" wrote:
Both formulas are correct, but the range of application is a bit off.
The second formula is an asymptotic expansion. That means that if you
use enough terms, it will fail to converge for any finite z. You can
stop the sum when the next term is larger in magnitude than the previous
one, but you would need to use a larger change point (z2) before using
the second formula.
That asymptotic expansion can be converted to to a continued fraction,
Abramowitz & Stegun equation 7.1.14
http://jove.prohosting.com/~skripty/page_298.htm
that is absolutely convergent for all positive z. You would switch
between your first formula and the continued fraction around z=2.
Jerry
Rijan wrote:
Dear Jerry and Dana,
Thanks for your replies. But still I could not calculate NORMDIST without
using Excel. Would you please check the following equations which I have used
for ERF?
For z less than 1, ERF = 2/SQRT (pi) * e^(-z^2) * z (1+ (2z^2)/3 +
((2z^2)^2)/15 + €¦
For z greater than 1, ERF = 1- (e^(-z^2))/(SQRT(pi)) * (1/z - 1/(2z^3) +
3/(4z^5) -€¦.)