Python math.erf() Method
Python math.erf(x)The method returns the error function of a number.
math.erf(x)The method accepts values between -inf and +inf, and returns a value between -1 and +1.
Python version: 3.2
Syntax
The syntax of the math.erf() method is as follows:
math.erf(x)
Parameter description:
- x-- Required, number. If x is not a number, returns TypeError.
Return Value
A float value, representing the error function of a number.
Example
The following example calculates the error function of the same positive and negative numbers:
Example
# Import math package
import math
# Output error function
print (math.erf(1.28))
print (math.erf(-1.28))
import math
# Output error function
print (math.erf(1.28))
print (math.erf(-1.28))
Output result:
0.9297341930135782 -0.9297341930135782Other extensions
Python math Module