Previous Up Next

6.8.11 Error function: erf

The error function erf is defined by:

 erf(x)=
2
√
π
∫
x


0
e−t2dt 

where the constant 2/√π is chosen so that

  erf(+∞)=1,   erf(−∞)=−1 

since

∫
+∞


0
e−t2dt=
√
π
2
 

The erf command computes the error function.


Examples.


Remark.
The relation between erf and normal_cdf (see Section ‍9.4.7) is:

normal_cdf(x)=
1
2
+
1
2
erf(
x
√
2
)

Indeed, making the change of variable t=u*√2 in

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


0
e−t2/2dt

gives:

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


0
e−u2du=
1
2
+
1
2
erf(
x
√
2
)

Check:
Input:

normal_cdf(1.0)

Output:

0.841344746069

Previous Up Next