Skip to Main Content Skip to Search
Product Documentation

erf - Error function

Syntax

erf(x)
erf(A)

Description

erf(x) computes the error function of x.

erf(A) computes the error function of each element of A.

Tips

Input Arguments

x

Symbolic number, variable, or expression.

A

Vector or matrix of symbolic numbers, variables, or expressions.

Definitions

Error Function

The following integral defines the error function:

Examples

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

[erf(1/2), erf(1.41), erf(sqrt(2))]
ans =
    0.5205    0.9539    0.9545
 

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

[erf(sym(1/2)), erf(sym(1.41))]
ans =
[ erf(1/2), erf(141/100)]
 

Compute the error function for x = 0, x = ∞, and x = –∞. The error function has special values for these parameters:

[erf(0), erf(inf), erf(-inf)]
ans =
     0     1    -1

Compute the error function for complex infinities. Use sym to convert complex infinities to symbolic objects:

[erf(sym(i*inf)), erf(sym(-i*inf))]
ans =
[ Inf*i, -Inf*i]
 

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

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

Now compute the derivatives of these expressions:

diff(erf(x), x, 2)
diff(erf(f), x)
ans =
-(4*x*exp(-x^2))/pi^(1/2)
 
ans =
(2*exp(-(sin(x) + x*exp(x))^2)*(cos(x) + exp(x) + x*exp(x)))/pi^(1/2)
 

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

M =sym([0 inf; 1/3 -inf]);
V = sym([1; -i*inf]);
erf(M)
erf(V)
ans =
[        0,  1]
[ erf(1/3), -1]
 
ans =
 erf(1)
 -Inf*i

Algorithms

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

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

References

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.

See Also

erfc | erfcinv | erfinv

How To

  


Free Symbolic Math Interactive Kit

See how symbolic computations can help you find analytical solutions to math and engineering problems.

Get free kit

Trials Available

Try the latest version of symbolic math products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS