Previous Up Next

6.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 18.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
x


0
et2/2dt

gives:

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


0
eu2du=
1
2
+
1
2
erf




x
2





.

To verify:

normal_cdf(1.0)
     
0.841344746069           

Previous Up Next