NAME

cerf, cerfc - complex error functions

SYNOPSIS

#include <cerf.h>

double _Complex cerf ( double _Complex z );

double _Complex cerfc ( double _Complex z );

DESCRIPTION

The function cerf is the complex version of the error function: erf(z) = 2/sqrt(pi) * integral from 0 to z of exp(-t*t) dt.

The complementary complex error function cerfc is defined as erfc(z) = 1-cerf(z).

ACCURACY

Errors are given in units of eps = 2^-53 = 1.1e-16, as relative deviations of the modulus from high-precision reference values.

Both functions are computed from Faddeeva's function w_of_z(3) through the factor exp(-z^2), as erfc(z) = exp(-z^2) w(iz) and erf(z) = 1 - erfc(z). The argument -z^2 = (y-x)(x+y) - 2ixy is rounded to double before the exponential is taken, which perturbs the modulus of that factor by up to about 1.5 |x^2-y^2| eps and its phase by up to about 0.5 |2xy| eps. The relative error of cerfc therefore grows in proportion to |z|^2; it stays below about 1.6 |z|^2 eps + 5 eps, and errors close to this bound do occur, for instance 1080 eps at |z| = 26. This limit is intrinsic to the evaluation of exp(-z^2) in double precision.

cerf shares this error in absolute terms; where |erf(z)| is small, it is amplified accordingly: without bound near the zeros of erf, the first of which lie at z = +-1.4506 +- 1.8809i, and up to about 120 eps close to the origin, for 0.01 < |z| < 0.1 off the coordinate axes, where the Maclaurin series is not used. Likewise, cerfc loses accuracy without bound near its zeros, the first of which lie at z = -1.3548 +- 1.9915i.

For Im z >= 0 and |z| < 7, generated tests at 37670 points, up to 20 per tile of the disc, hold the relative error of cerf below 129 eps and that of cerfc below 86 eps; the largest deviations found are 126 eps, next to a zero of erf, and 82 eps.

SEE ALSO

The computations are based on Faddeeva's function w_of_z(3).

Other complex error functions in libcerf: w_of_z(3), dawson(3), voigt(3), erfcx(3), erfi(3).

The real error function comes with recent versions of glibc, as requested by the C99 standard: erf(3)

Homepage: https://jugit.fz-juelich.de/mlz/lib/cerf

AUTHORS

Steven G. Johnson, Massachusetts Institute of Technology, wrote this function as part of the MIT Faddeeva package.

Joachim Wuttke, Forschungszentrum Juelich, reorganized the code into a library, and wrote this man page.

CONTACT

Please report bugs to the maintainer:

Joachim Wuttke <j.wuttke@fz-juelich.de>

COPYING

Copyright (c) 2012 Massachusetts Institute of Technology

Copyright (c) 2013 Forschungszentrum Juelich GmbH

Software: MIT License.

This documentation: Creative Commons Attribution Share Alike.