Python – erf() Function – Examples & Explanation

erf() function is used to find the can be used to compute traditional statistical functions such as the cumulative standard normal distribution in Python for the given input(x – parameter).

 

Syntax of erf() Function

The syntax of erf() function in Python is:

math.erf(x)

 

Parameters of erf() Function in Python

x – Where x is any valid python number (positive or negative). This parameter is required.
Note: If the x parameter is not a number, erf() function will return an Error.

 

Compatibility

erf() function is available and compatible with both Python 2.x and 3.x. This function is a part of python standard math library.

 

Return Value of erf() Function in Python

erf() function returns can be used to compute traditional statistical functions such as the cumulative standard normal distribution for the given input.

 

Python erf() Function Example

# import math library
import math
print(math.erf(-0.2))
print(math.erf(0))
print(math.erf(0.2))
print(math.erf(77))
print(math.erf(-3677))

Output:

-0.22270258921047842
0.0
0.22270258921047842
1.0
-1.0