erf, erfc
-- the error function and
the complementary error functionerf(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).
erf(x)
erfc(x)
x |
- | an arithmetical expression |
an arithmetical expression.
When called with a floating point argument, the functions are
sensitive to the environment variable DIGITS
which determines the numerical
working precision.
erf(0)=0, erf(infinity)=1, erf(-infinity)=-1,
erfc(0)=1, erfc(infinity)=0, erfc(-infinity)=2
are implemented. For all other arguments, unevaluated function calls are returned.
erfc
may be truncated to
0.0
. For large negative real part it may be rounded to
2.0
. Knowing that erf(x)=1-erfc(x),
erf
may also return correspondingly rounded values for
arguments in this section. Cf. example 2.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
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'
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 /
erf
and erfc
are entire functions.