PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_specfun_erfc_complex (s15dd)
Purpose
nag_specfun_erfc_complex (s15dd) computes values of the function , for complex .
Syntax
Description
nag_specfun_erfc_complex (s15dd) computes values of the function
, where
is the complementary error function
for complex
. The method used is that in
Gautschi (1970) for
in the first quadrant of the complex plane, and is extended for
in other quadrants via the relations
and
. Following advice in
Gautschi (1970) and
van der Laan and Temme (1984), the code in
Gautschi (1969) has been adapted to work in various precisions up to
decimal places. The real part of
is sometimes known as the Voigt function.
References
Gautschi W (1969) Algorithm 363: Complex error function Comm. ACM 12 635
Gautschi W (1970) Efficient computation of the complex error function SIAM J. Numer. Anal. 7 187–198
van der Laan C G and Temme N M (1984) Calculation of special functions: the gamma function, the exponential integrals and error-like functions CWI Tract 10 Centre for Mathematics and Computer Science, Amsterdam
Parameters
Compulsory Input Parameters
- 1:
– complex scalar
-
The argument of the function.
Optional Input Parameters
None.
Output Parameters
- 1:
– complex scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
- W
-
The real part of the result overflows, and is set to the largest safe number with the correct sign. The imaginary part of the result is meaningful.
- W
-
The imaginary part of the result overflows, and is set to the largest safe number with the correct sign. The real part of the result is meaningful.
- W
-
Both real and imaginary parts of the result overflow, and are set to the largest safe number with the correct signs.
- W
-
The result returned is accurate to less than half precision, due to the size of an intermediate result.
-
-
The result returned has no precision, due to the size of an intermediate result, and is set to zero.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The accuracy of the returned result depends on the argument
. If
lies in the first or second quadrant of the complex plane (i.e.,
is greater than or equal to zero), the result should be accurate almost to
machine precision, except that there is a limit of about
decimal places on the achievable accuracy because constants in the function are given to this precision. With such arguments,
ifail can only return as
.
If however is less than zero, accuracy may be lost in two ways; firstly, in the evaluation of , if is large, in which case a warning will be issued through or ; and secondly, near the zeros of the required function, where precision is lost due to cancellation, in which case no warning is given – the result has absolute accuracy rather than relative accuracy. Note also that in this half-plane, one or both parts of the result may overflow – this is signalled through , or .
Further Comments
The time taken for a call of nag_specfun_erfc_complex (s15dd) depends on the argument , the time increasing as .
nag_specfun_erfc_complex (s15dd) may be used to compute values of
and
for complex
by the relations
,
. (For double arguments,
nag_specfun_erfc_real (s15ad) and
nag_specfun_erf_real (s15ae) should be used.)
Example
This example reads values of the argument from a file, evaluates the function at each value of and prints the results.
Open in the MATLAB editor:
s15dd_example
function s15dd_example
fprintf('s15dd example results\n\n');
z = [ 1 + 1e-9i;
-3.01 + 0.75i;
2.75 - 1.52i;
-1.33 - 0.54i];
n = size(z,1);
w = z;
for j=1:n
[w(j), ifail] = s15dd(z(j));
end
disp(' z w(z)');
disp([z w]);
s15dd example results
z w(z)
1.0000 + 0.0000i 0.3679 + 0.6072i
-3.0100 + 0.7500i 0.0522 - 0.1838i
2.7500 - 1.5200i -0.1015 + 0.1654i
-1.3300 - 0.5400i -0.1839 - 0.7891i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015