1 |
|
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 | ## Examples
|
36 |
|
37 | ```js
|
38 | math.erf(0.2) // returns 0.22270258921047847
|
39 | math.erf(-0.5) // returns -0.5204998778130465
|
40 | math.erf(4) // returns 0.9999999845827421
|
41 | ```
|
42 |
|
43 |
|