### 5.9.5 Error function : erf

erf takes as argument a number a.
erf returns the floating point value of the error function at x=a, where the error function is defined by :

erf(x)=

2

√

π

∫

x
0

e−t2dt

The normalization is chosen so that:

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

since :

∫

+∞
0

e−t2dt=

√

π

2

Input :

erf(1)

Output :

0.84270079295

Input :

erf(1/(sqrt(2)))*1/2+0.5

Output :

0.841344746069

Remark
The relation between erf and normal_cdf 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 :
normal_cdf(1)=0.841344746069