Previous Page Next Page Contents

erf, erfc -- the error function and the complementary error function

Introduction

erf(x) represents the error function (2/sqrt(PI))*int(exp(-t^2), t=0..x). The complementary error function is erfc(x)=1-erf(x) =(2/sqrt(PI))*int(exp(-t^2), x..infinity).

Call(s)

erf(x)
erfc(x)

Parameters

x - an arithmetical expression

Returns

an arithmetical expression.

Side Effects

When called with a floating point argument, the functions are sensitive to the environment variable DIGITS which determines the numerical working precision.

Details

Example 1

We demonstrate some calls with exact and symbolic input data:

>> erf(0), erf(3/2), erf(sqrt(2)), erf(infinity)
                                           1/2
                         0, erf(3/2), erf(2   ), 1
>> erfc(0), erfc(x + 1), erfc(-infinity)
                             1, erfc(x + 1), 2

Floating point values are computed for floating point arguments:

>> erf(-7.2), erf(2.0 + 3.5*I), erfc(100.0 + 100.0*I)
      -1.0, 421.8123327 + 343.6612334 I,
      
         0.0006523436638 - 0.003935726363 I

Example 2

For large floating point arguments with positive real parts the values returned by erfc may be truncated to 0.0:

>> erfc(2411.3), erfc(2411.4)
                         3.678326052e-2525152, 0.0

This protection against numerical underflow is builtin for arguments satisfying abs(Im(x))<=abs(Re(x))/10.

>> erfc(2500.0 + 250.0*I)
                                    0.0

Errors may occur outside this region in the complex plane:

>> erfc(2500.0 + 250.1*I)
      Error: Overflow/underflow in arithmetical operation;
      during evaluation of 'erfc::float'

Example 3

The functions diff, float, limit, and series handle expressions involving the error functions:

>> diff(erf(x), x, x, x), float(ln(3 + erfc(sqrt(PI)*I)))
            2        2             2
         8 x  exp(- x )   4 exp(- x )
         -------------- - -----------, 2.309003461 - 1.16207002 I
               1/2             1/2
             PI              PI
>> limit(x/(1 + x)*erf(x), x = infinity)
                                     1
>> series(erfc(x), x = infinity, 4)
                         2           2      /        2  \
                  exp(- x )   exp(- x )     | exp(- x ) |
                  --------- - ---------- + O| --------- |
                       1/2       3   1/2    |     4     |
                   x PI       2 x  PI       \    x      /

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000