erf

erf(x)

Compute the error function of x, defined by $\frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt$ for arbitrary complex x.

Examples

julia> A = rand(10,5)
       b = rand(10)
       x = A \ b
       B = A' * A
       erf(eigvals(B)) - 2x.^2 + 4x - 6

5-element Array{Float64,1}:
 -6.29936
 -3.67082
 -8.87201
 -3.20876
 -4.82683
  1. Compute the error function for a real number:

    julia> x = 1.5;
    julia> erf(x)
    0.9661051464753108

    This example calculates the error function value for the real number x = 1.5.

  2. Compute the error function for a complex number:

    julia> x = 2 + 3im;
    julia> erf(x)
    -0.4518627618776061 + 2.2873552871788423im

    It computes the error function value for the complex number x = 2 + 3im.

  3. Compute the error function for an array of numbers:
    julia> x = [0.5, 1.0, 1.5];
    julia> erf.(x)
    3-element Array{Float64,1}:
    0.5204998778130465
    0.842700792949715
    0.9661051464753108

    This example calculates the error function values for each element of the array x.

Common mistake example:

julia> x = "abc";
julia> erf(x)
ERROR: MethodError: no method matching erf(::String)

In this example, the argument x is of type String, which is not a valid input for the erf function. Make sure to pass the correct type of argument to the erf function, such as a real or complex number.

See Also

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: