The error function erf is defined by:
erf(x)= |
| ∫ |
| e−t2dt, |
where the constant 2/√π is chosen so that erf(+∞)=1 and erf(−∞)=−1, since
∫ |
| e−t2dt= |
| . |
The erf command computes the error function.
erf(1) |
|
erf(1.0) |
|
erf(1/(sqrt(2)))*1/2+0.5 |
|
The relation between erf and normal_cdf (see Section 18.4.7) is:
normal_cdf(x)= |
| + |
| erf | ⎛ ⎜ ⎜ ⎜ ⎜ ⎝ |
| ⎞ ⎟ ⎟ ⎟ ⎟ ⎠ |
Indeed, making the change of variable t=u√2 in
normal_cdf(x)= |
| + |
| ∫ |
| e−t2/2dt |
gives:
normal_cdf(x)= |
| + |
| ∫ |
| e−u2du= |
| + |
| erf | ⎛ ⎜ ⎜ ⎜ ⎜ ⎝ |
| ⎞ ⎟ ⎟ ⎟ ⎟ ⎠ | . |
To verify:
normal_cdf(1.0) |
|