src/sample/Util.java
// from Chebyshev fitting formula for erf(z) from Numerical Recipes, 6.2
from Chebyshev fitting formula for erf(z) from Numerical Recipes, 6.2
from Chebyshev fitting formula for erf ( z ) from Numerical Recipes 6 . 2
public static double erf(double z) {
            double t = 1.0 / (1.0 + 0.5 * java.lang.Math.abs(z));
            double ans = 1 - t * java.lang.Math.exp(-z * z - 1.26551223 +
                    t * (1.00002368 +
                            t * (0.37409196 +
                                    t * (0.09678418 +
                                            t * (-0.18628806 +
                                                    t * (0.27886807 +
                                                            t * (-1.13520398 +
                                                                    t * (1.48851587 +
                                                                            t * (-0.82215223 +
                                                                                    t * (0.17087277))))))))));
            if (z >= 0) return ans;
            else return -ans;
        }
public static double erf ( double z ) { double t = 1.0 / ( 1.0 + 0.5 * java . lang . Math . abs ( z ) ) ; double ans = 1 - t * java . lang . Math . exp ( - z * z - 1.26551223 + t * ( 1.00002368 + t * ( 0.37409196 + t * ( 0.09678418 + t * ( - 0.18628806 + t * ( 0.27886807 + t * ( - 1.13520398 + t * ( 1.48851587 + t * ( - 0.82215223 + t * ( 0.17087277 ) ) ) ) ) ) ) ) ) ) ; if ( z >= 0 ) return ans ; else return - ans ; }
from Chebyshev fitting formula for erf(z) from Numerical Recipes, 6.2
from Chebyshev fitting formula for erf ( z ) from Numerical Recipes 6 . 2
// use Horner's method