math.erfc()

Anonymous contributor's avatar
Anonymous contributor
Published Sep 17, 2024
Contribute to Docs

The math.erfc() method returns the complementary error function of a number. This method accepts a value between -inf and +inf and returns a floating-point value between 0 and 2.

Syntax

math.erfc(x)
  • x: A required parameter that should be a real number.

Example

The following example demonstrates the usage of the math.erfc() method:

# Import the 'math' library
import math
# Print the complementary error functions of different numbers
print(math.erfc(0.67))
print(math.erfc(1.34))
print(math.erfc(-6))

The above example produces the following output:

0.3433722976996949
0.058086284741634665
2.0

Note: If the input value is not a real number, a TypeError is raised.

Codebyte Example

Run the following codebyte example to understand how the math.erfc() method works:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy