Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python math.erf() function is used to return the error function of the argument. The error function of x is defined as:

erf function

Error functions usually occur in probability, statistics and partial differential equation describing diffusion.

Error Function

Syntax

math.erf(x)   

Parameters

x Required. Specify the value.

Return Value

Returns the error function of the argument.

Example:

In the below example, erf() function is used to return the error function of the given value.

import math

print(math.erf(0))
print(math.erf(1))
print(math.erf(2))
print(math.erf(-1))
print(math.erf(-2))

The output of the above code will be:

0.0
0.84270079295
0.995322265019
-0.84270079295
-0.995322265019

❮ Python Math Module