A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/python_math_erfc_method.htm below:

Python math.erfc() Method

Python math.erfc() Method

The Python math.erfc() method is used to calculate the complementary error method, which is defined as 1 − erf(x), where erf(x) is the error method.

This method represents the probability of an event lying outside a certain range for a normally distributed random variable. Mathematically, the complementary error method is defined as −

$$\mathrm{erfc(x)\:=\:1\:-\:erf(x)\:=\frac{2}{\sqrt{\prod}}\int_{x}^{∞}\:e^{-t^{2}}dt}$$

Where, e is the base of the natural logarithm and π is the mathematical constant pi. The complementary error method is an even method, meaning that erfc(-x) = erfc(x) and is being bounded between 0 and 2.

Syntax

Following is the basic syntax of the Python math.erfc() method −

math.erfc(x)
Parameters

This method accepts a real number or a numeric expression as a parameter for which you want to calculate the complementary error method.

Return Value

The method returns the value of the complementary error method evaluated at x.

Example 1

In the following example, we are calculating the complementary error method for a positive real number using the math.erfc() method −

import math
x = 1.5
result = math.erfc(x)
print("Complementary Error method for x =", x, ":", result)
Output

The output obtained is as follows −

Complementary Error method for x = 1.5 : 0.033894853524689274
Example 2

In here, we are calculating the complementary error method for a negative real number using the math.erfc() method −

import math
x = -0.75
result = math.erfc(x)
print("Complementary Error method for x =", x, ":", result)
Output

Following is the output of the above code −

Complementary Error method for x = -0.75 : 1.7111556336535152
Example 3

In this example, we are evaluating the sum of complementary error methods for x=2 and x/2 using the math.erfc() method −

import math
x = 2
result = math.erfc(x) + math.erfc(x/2)
print("Complementary Error method expression result for x =", x, ":", result) 
Output

We get the output as shown below −

Complementary Error method expression result for x = 2 : 0.1619769420313324
Example 4

Now, we use the math.erfc() method to directly calculate the complementary error method for x=0 −

import math
x = 0
result = math.erfc(x)
print("Complementary Error method for x =", x, ":", result)
Output

The result produced is as shown below −

Complementary Error method for x = 0 : 1.0

python_maths.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4