Previous Up Next

7.3.11  Error function

The error function erf is defined by:

  erf(x)=
2
π
x


0
et2dt,

where the constant 2/√π is chosen so that erf(+∞)=1 and erf(−∞)=−1, since

  
+∞


0
et2dt=
π
2
.

The erf command computes the error function.

Examples

erf(1)
     
erf
1
          
erf(1.0)
     
0.84270079295           
erf(1/(sqrt(2)))*1/2+0.5
     
0.841344746069           
Remark.

The relation between erf and normal_cdf (see Section 20.4.7) is:

  normal_cdf(x)=
1
2
+
1
2
erf




x
2





Indeed, making the change of variable t=u2 in normal_cdf(x)=1/2+1/√0xet2/2dt yields:

  normal_cdf(x)=
1
2
+
1
π
x
2


0
eu2du=
1
2
+
1
2
erf




x
2





.

Previous Up Next