Function erf #

Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x.

This is a translation of W. J. Cody’s Fortran implementation from 1987 ( ). See the AMS publication “Rational Chebyshev Approximations for the Error Function” by W. J. Cody for an explanation of this process.

For matrices, the function is evaluated element wise.

Syntax #


Parameters #

Parameter Type Description
x number | Array | Matrix A real number

Returns #

Type Description
number | Array | Matrix The erf of x

Examples #

math.erf(0.2);    // returns 0.22270258921047847
math.erf(-0.5);   // returns -0.5204998778130465
math.erf(4);      // returns 0.9999999845827421
Fork me on GitHub