erf.md (1045B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function erf 4 5 Compute the erf function of a value using a rational Chebyshev 6 approximations for different intervals of x. 7 8 This is a translation of W. J. Cody's Fortran implementation from 1987 9 ( https://www.netlib.org/specfun/erf ). See the AMS publication 10 "Rational Chebyshev Approximations for the Error Function" by W. J. Cody 11 for an explanation of this process. 12 13 For matrices, the function is evaluated element wise. 14 15 16 ## Syntax 17 18 ```js 19 math.erf(x) 20 ``` 21 22 ### Parameters 23 24 Parameter | Type | Description 25 --------- | ---- | ----------- 26 `x` | number | Array | Matrix | A real number 27 28 ### Returns 29 30 Type | Description 31 ---- | ----------- 32 number | Array | Matrix | The erf of `x` 33 34 35 ### Throws 36 37 Type | Description 38 ---- | ----------- 39 40 41 ## Examples 42 43 ```js 44 math.erf(0.2) // returns 0.22270258921047847 45 math.erf(-0.5) // returns -0.5204998778130465 46 math.erf(4) // returns 0.9999999845827421 47 ``` 48 49