6.8.11 Error function: erf
The error function erf is defined by:
where the constant 2/√π is chosen so that
since
The erf command computes the error function.
-
erf takes one argument:
a, a number.
- erf(a) returns the value of erf(a).
Examples.
-
Input:
erf(1)
Output:
- Input:
erf(1.0)
Output:
- Input:
erf(1/(sqrt(2)))*1/2+0.5
Output:
Remark.
The relation between erf and normal_cdf (see
Section 9.4.7) is:
Indeed, making the change of variable t=u*√2 in
gives:
normal_cdf(x)= | | + | | ∫ | | e−u2du= | | + | | erf( | | )
|
Check:
Input:
normal_cdf(1.0)
Output: