Python Tutorial Python Advanced Python References Python Libraries

Python math - erf() Function



The Python math.erf() function returns 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 example below, erf() function returns the error function of the given value.

import math

print(math.erf(0))
print(math.erf(1))
print(math.erf(2),"\n")

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

The output of the above code will be:

0.0
0.8427007929497149
0.9953222650189527 

-0.1124629160182849
-0.8427007929497149
-0.9953222650189527

❮ Python Math Module