Main Content

erfcinv

Inverse complementary error function

Description

example

erfcinv(X) computes the inverse complementary error function of X. If X is a vector or a matrix, erfcinv(X) computes the inverse complementary error function of each element of X.

Examples

Inverse Complementary Error Function for Floating-Point and Symbolic Numbers

Depending on its arguments, erfcinv can return floating-point or exact symbolic results.

Compute the inverse complementary error function for these numbers. Because these numbers are not symbolic objects, you get floating-point results:

A = [erfcinv(1/2), erfcinv(1.33), erfcinv(3/2)]
A =
    0.4769   -0.3013   -0.4769

Compute the inverse complementary error function for the same numbers converted to symbolic objects. For most symbolic (exact) numbers, erfcinv returns unresolved symbolic calls:

symA = [erfcinv(sym(1/2)), erfcinv(sym(1.33)), erfcinv(sym(3/2))]
symA =
[ -erfcinv(3/2), erfcinv(133/100), erfcinv(3/2)]

Use vpa to approximate symbolic results with the required number of digits:

d = digits(10);
vpa(symA)
digits(d)
ans =
[ 0.4769362762, -0.3013321461, -0.4769362762]

Inverse Complementary Error Function for Variables and Expressions

For most symbolic variables and expressions, erfcinv returns unresolved symbolic calls.

Compute the inverse complementary error function for x and sin(x) + x*exp(x). For most symbolic variables and expressions, erfcinv returns unresolved symbolic calls:

syms x
f = sin(x) + x*exp(x);
erfcinv(x)
erfcinv(f)
ans =
erfcinv(x)
 
ans =
erfcinv(sin(x) + x*exp(x))

Inverse Complementary Error Function for Vectors and Matrices

If the input argument is a vector or a matrix, erfcinv returns the inverse complementary error function for each element of that vector or matrix.

Compute the inverse complementary error function for elements of matrix M and vector V:

M = sym([0 1 + i; 1/3 1]);
V = sym([2; inf]);
erfcinv(M)
erfcinv(V)
ans =
[           Inf, NaN]
[ -erfcinv(5/3),   0]

ans =
 -Inf
  NaN

Special Values of Inverse Complementary Error Function

erfcinv returns special values for particular parameters.

Compute the inverse complementary error function for x = 0, x = 1, and x = 2. The inverse complementary error function has special values for these parameters:

[erfcinv(0), erfcinv(1), erfcinv(2)]
ans =
   Inf     0  -Inf

Handling Expressions That Contain Inverse Complementary Error Function

Many functions, such as diff and int, can handle expressions containing erfcinv.

Compute the first and second derivatives of the inverse complementary error function:

syms x
diff(erfcinv(x), x)
diff(erfcinv(x), x, 2)
ans =
-(pi^(1/2)*exp(erfcinv(x)^2))/2
 
ans =
(pi*exp(2*erfcinv(x)^2)*erfcinv(x))/2

Compute the integral of the inverse complementary error function:

int(erfcinv(x), x)
ans =
exp(-erfcinv(x)^2)/pi^(1/2)

Plot Inverse Complementary Error Function

Plot the inverse complementary error function on the interval from 0 to 2.

syms x
fplot(erfcinv(x),[0 2])
grid on

Input Arguments

collapse all

Input, specified as a symbolic number, variable, expression, or function, or as a vector or matrix of symbolic numbers, variables, expressions, or functions.

More About

collapse all

Inverse Complementary Error Function

The inverse complementary error function is defined as erfc-1(x), such that erfc(erfc-1(x)) = x. Here

erfc(x)=2πxet2dt=1erf(x)

is the complementary error function.

Tips

  • Calling erfcinv for a number that is not a symbolic object invokes the MATLAB® erfcinv function. This function accepts real arguments only. If you want to compute the inverse complementary error function for a complex number, use sym to convert that number to a symbolic object, and then call erfcinv for that symbolic object.

  • If x < 0 or x > 2, or if x is complex, then erfcinv(x) returns NaN.

Algorithms

The toolbox can simplify expressions that contain error functions and their inverses. For real values x, the toolbox applies these simplification rules:

  • erfinv(erf(x)) = erfinv(1 - erfc(x)) = erfcinv(1 - erf(x)) = erfcinv(erfc(x)) = x

  • erfinv(-erf(x)) = erfinv(erfc(x) - 1) = erfcinv(1 + erf(x)) = erfcinv(2 - erfc(x)) = -x

For any value x, the toolbox applies these simplification rules:

  • erfcinv(x) = erfinv(1 - x)

  • erfinv(-x) = -erfinv(x)

  • erfcinv(2 - x) = -erfcinv(x)

  • erf(erfinv(x)) = erfc(erfcinv(x)) = x

  • erf(erfcinv(x)) = erfc(erfinv(x)) = 1 - x

References

[1] Gautschi, W. “Error Function and Fresnel Integrals.” Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.

Version History

Introduced in R2012a

See Also

| | |