Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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$$

share|improve this question
    
Wiki suggests an approximation en.wikipedia.org/wiki/… –  user17762 Jun 3 '11 at 2:37
    
possible duplicate of Definite integral of Normal Distribution –  user17762 Jun 3 '11 at 2:43
1  
Related: stats.stackexchange.com/questions/7200/… –  cardinal Jun 3 '11 at 8:30
    
possible duplicate of How to accurately calculate erf(x) with a computer? –  J. M. Jul 23 '11 at 15:26
    
You will find implementations in most scientific libraries: cmlib, slatec, nswc, nag, imsl, harwell hsl... Also in gnu gsl, in R, probably octave and Scilab... You can also have a look at ACM TOMS Collected Algorithms. There are plenty of places to look for this. –  Jean-Claude Arbaut 21 hours ago

3 Answers 3

up vote 2 down vote accepted

"Efficient and accurate" is probably contradictory... Have you tried the one listed in http://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions ?

share|improve this answer
    
yes, I have tried this. Its accuracy is up to 2 decimal places. Do we have more than this? –  shaikh Jun 3 '11 at 2:40
    
@shaikh, C99 has an erf function, which should be quite accurate. –  lhf Jun 3 '11 at 2:42
    
where can I find the derivation of C99 erf...? –  shaikh Jun 3 '11 at 2:45
    
@shaikh, oh, you have to read the code. See for instance the cephes library. –  lhf Jun 3 '11 at 2:48
    
@shaikh: Or boost's implementation –  ziyuang Jun 3 '11 at 2:51

How about this: Computation of the error function erf in arbitrary precision with correct rounding

share|improve this answer
    
I will try this. thx –  shaikh Jun 3 '11 at 2:42

I know its an old post, but others stumbling upon this post might find it helpful. You can try the accurate approximate analytical expression for faster numerical evaluation such as this or answers in this post especially by Ron Gordon.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.