math.erf()

Anonymous contributor's avatar
Anonymous contributor
Published Aug 24, 2024
Contribute to Docs

The math.erf() function returns the error function of a number.

Syntax

math.erf(n)
  • n: A real number for which the error function is to be computed.

The math.erf() function accepts any real number from negative infinity to positive infinity as input and returns a value between -1 and 1, representing the error function of that number.

Example

In the example below, math.erf() returns the error function of 1:

import math
print(math.erf(1))

The above code gives the following output:

0.8427007929497149

Codebyte Example

Run the following example that uses the math.erf() function to understand its working:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy