Accurate approximations for the complex error function with small imaginary argument
In this paper we present two efficient approximations for the complex error function with small imaginary argument over the range that is commonly considered difficult for highly accurate and rapid computation. These approximations are expressed in terms of the Dawson’s integral of real argument that enables their efficient implementation in a rapid algorithm. The error analysis we performed using the random input numbers and reveals that in the real and imaginary parts the average accuracy of the first approximation exceeds and , while the average accuracy of the second approximation exceeds and , respectively. The first approximation is slightly faster in computation. However, the second approximation provides excellent high-accuracy coverage over the required domain.
Keywords: Complex error function, Voigt function, Faddeeva function, Kramp function, Dawson’s integral
respectively. The real part of the complex error function is known as the Voigt function , widely used in many fields of Physics, Astronomy and Chemistry [10, 11, 12, 13]. Combining the real (2) and imaginary (3) parts together as yields
None of the integrals above can be taken analytically in closed form. Consequently, the complex error function must be computed numerically.
it follows that only positive arguments and are sufficient in order to cover the entire complex plane. Therefore, we will imply further that both input parameters and are always positive.
can be effectively used for high-accuracy and rapid computation of the complex error function .
There are several approximations such as the Chiarella and Reichel approximation (equation (15) in ), the Weideman’s rational approximation (equation (38-I) in ), the exponential series approximation (equation (14) in  and its modification (3) in ) and the rational approximation (equation (14) in ) that provide highly accurate and rapid calculation for the complex error function within domain and .
However, the highly accurate and simultaneously rapid computation of at and still remains problematic [23, 24]. Different approaches have been implemented to overcome this problem. For example, Zaghloul and Ali developed Algorithm 916 that can cover accurately this domain . In the rapid algorithm developed by Karbach et al.  this domain is covered by using the exponential series approximation (equation (14) in ), the Taylor expansion series near singularities at ( is the index integer and is the integration cutoff) and the Laplace continued fraction. In our recent work we proposed to cover this domain by using the master-slave algorithm  (see also Matlab source code in , where the master-slave approach has been implemented to cover it). In this paper we report two new approximations that also effectively resolve this problem for accurate and rapid computation.
2 Approximations for small y
A simplest way to approximate the complex error function is to use the Maclaurin expansion series near the point (see for example two approximations (Appendix A) and (Appendix A) in Appendix A). However, this method results in a moderate accuracy that does not exceed in the range of a concern at .
In order to obtain more efficient approximations, we may attempt to find an appropriate representation of the complex error function . Let us rewrite the equation of the complex error function (4) as
Change of the variable in equation above excludes the parameter from the integrand:
Consequently, this equation can be rearranged as
The first integral in the equation above is
is the Dawson’s integral. As the argument in is real, its computation is not difficult and several efficient approximations that can provide rapid and highly accurate computation are reported in literature [26, 27, 28]. Furthermore, the latest versions of Matlab support the built-in function dawson(x) that computes very rapidly the Dawson’s integral of real argument.
The advantage of the equation (5) is that the integration range in the second integral at is very narrow. Consequently, the second integral in equation (5) makes only a minor contribution to the complex error function . As a result, this minimizes the error in computation.
As the upper limit of the second integral of equation (5) is finite, its evaluation is not straightforward (see Appendix B). However, this problem can be overcome by Maclaurin expansion of the exponential function:
The first approximation is obtained by substituting only the first term of this expansion into the second integral of equation (5) that yields
We will refer to this equation as the basic approximation. This equation is highly accurate while .
The second approximation is obtained by substituting the first two terms of the expansion above into second integral of the equation (5):
Further, we will refer to this equation as the main approximation.
3 Algorithmic implementation
Approximations (6) and (7) cannot be employed directly in the computation flow since at the denominators in approximation (6) and in approximation (7) blow up the ratios resulting to computational overflow. However, this problem is very easy to resolve by using, for example, the following supplement:
In particular, the computation flow for the basic and the main approximations can be maintained as
4 Error analysis
Define the relative errors for the real and imaginary parts of the complex error function in forms
respectively, where is the reference. The highly accurate reference values can be obtained according to equation (1) by using the latest versions of Wolfram Mathematica that supports error function of complex argument.
Figure 1a shows the logarithm of relative error for the real part of the basic approximation (6) in the domain and . As we can see, at the approximation (6) is highly accurate and provides accuracy better than . Although the accuracy of the approximation (6) deteriorates as increases, it, nevertheless, still remains high and better than .
Figure 1b illustrates the logarithm of relative error for the imaginary part of the basic approximation (6) in the domain and . As one can see, the imaginary part of the approximation (6) is highly accurate. Specifically, the accuracy is better than almost over all of the domain. However, at small the accuracy deteriorates as it can be seen by red color along the left edge of -axis.
Figure 2a illustrates the logarithm of relative error for the real part of the supplementary approximation (8) over the small domain and . One can see that the real part over this domain is highly accurate and better than .
Figure 2b depicts the logarithm of relative error for the imaginary part of the supplementary approximation (8) over the small domain and . The accuracy of the imaginary part is also high and better than .
From Figs. 2a and 2b we can conclude that the basic approximation (6) alone may be used practically as the accuracy better than is more than enough for the most applications.
The accuracy of the complex error function can be further improved by using the main approximation (7). Figure 3a depicts the logarithm of relative error for the real part of the approximation (7) in the domain and . As it can be seen from this figure, in the real part the accuracy of the approximation (7) is better than .
Figure 3b shows the logarithm of relative error for the imaginary part of the main approximation (7) in the domain and . Comparing Figs. 3b with 1b one can observe that the graphs are nearly same. This signifies that the behavior of the basic and the main approximations resemble in their imaginary parts. Similar to Fig. 1b, the accuracy in the imaginary part is better than almost over all domain.
To determine the average accuracy for both approximations, we performed calculations with randomly chosen input variables and . It has been found that in the real and imaginary parts the basic approximation (6) provides average accuracy exceeding and , while the main approximation (7) provides average accuracy exceeding and , respectively.
We present two efficient approximations for the complex error function that can be used for computation at small . As these approximation are expressed in terms of the Dawson’s integral of real argument , they are rapid in computation. Error analysis performed with randomly taken input variables and reveals that in the real and imaginary parts the basic approximation (6) provides average accuracy exceeding and , while the main approximation (7) provides average accuracy exceeding and , respectively. Although the basic equation (6) is slightly faster in computation, the main approximation (7) provides excellent high-accuracy coverage.
Consider the following Maclaurin expansions at :
while equation (Appendix A) immediately results in
The approximations (Appendix A) and (Appendix A) are rapid in computation because the error function of imaginary argument can be expressed in terms of the Dawson’s integral of real argument as follows
The second integral of equation (5) can be expressed as
The argument in the first error function is purely imaginary and, therefore, it can be expressed in term of the Dawson’s integral of real argument. However, since the argument in the second error function is complex, it needs a numerical solution (see for example equations (10) and (11) in ). When the high accuracy is not required, the rapid approximation for the error function can obtained, for example, by rearranging the expansion series (Appendix A) as
We can also approximate this integral by taking into account that . In particular, for small interval we can write and take the mid-point in that interval equal to :
Alternatively, according to the trapezoidal rule we get
Once again, these approximations should be applied only when the high-accuracy is not a concern in computation.
The second integral from equation (5) can be approximated more precisely by taking integration by parts
and then substituting the first few terms from the following expansion
into the right integral of equation (Appendix B). We will consider the simplest case when only the first term from this expansion is substituted. Following this procedure and using equation (5) we have
The consistency between approximations (6) and (Appendix B) becomes evident from the fact that . Although approximation (Appendix B) is more accurate than the basic approximation (6), it is slightly slower in computation at large size of the input array due to presence of the error function . Since the approximation (Appendix B) provides nearly same accuracy as the main approximation (7), both of them can be used when the high-accuracy computation is required.
This work is supported by National Research Council of Canada, Thoth Technology Inc. and York University. The authors wish to thank Prof. Ian McDade and Dr. Brian Solheim for discussions and constructive suggestions.
-  V. N. Faddeyeva and N. M. Terentâev, Tables of the probability integral for complex argument, Pergamon Press, Oxford, 1961.
-  M. Abramowitz, and I. A. Stegun, Error function and Fresnel integrals. Handbook of mathematical functions with formulas, graphs, and mathematical tables. Ed. Dover, New York, 1972, 297-309.
-  B. H. Armstrong and B. W. Nicholls, Emission, absorption and transfer of radiation in heated atmospheres, Pergamon Press, New York, 1972.
-  G. P. M. Poppe and C. M. J. Wijers, More efficient computation of the complex error function, ACM Transact. Math. Software, 16 (1990) 38-46.
-  G. P. M. Poppe and C. M. J. Wijers, Algorithm 680: evaluation of the complex error function, ACM Transact. Math. Software, 16 (1990) 47.
-  F. Schreier, The Voigt and complex error function: A comparison of computational methods, J. Quant. Spectrosc. Radiat. Transfer, 48 (1992) 743-762.
-  H. M. Srivastava and M. P. Chen, Some unified presentations of the Voigt functions, Astrophys. Space Sci., 192 (1992) 63-74.
-  G. Pagnini and F. Mainardi, Evolution equations for the probabilistic generalization of the Voigt profile function, J. Comput. Appl. Math., 233 (2010) 1590-1595.
-  K. L. Letchworth and D. C. Benner, Rapid and accurate calculation of the Voigt function, J. Quantit. Spectrosc. Radiat. Transfer, 107 (2007) 173-192.
-  L. E. Christensen, G. D. Spiers, R. T. Menzies and J. C. Jacob, Tunable laser spectroscopy of near : Atmospheric retrieval biases due to neglecting line-mixing, J. Quantit. Spectrosc. Radiat. Transfer, 113 (2012) 739-748.
-  V. Sonnenschein, S. Raeder, A. Hakimi, I. D. Moore and K. Wendt, Determination of the ground-state hyperfine structure in neutral , J. Phys. B: At. Mol. Opt. Phys. 45 (2012) 165005.
-  A. Berk, Voigt equivalent widths and spectral-bin single-line transmittances: Exact expansions and the MODTRAN®5 implementation, J. Quantit. Spectrosc. Radiat. Transfer, 118 (2013) 102-120.
-  B. M. Quine and S. M. Abrarov, Application of the spectrally integrated Voigt function to line-by-line radiative transfer modelling, J. Quantit. Spectrosc. Radiat. Transfer, 127 (2013) 37-48.
-  S. J. McKenna, A method of computing the complex probability function and other related functions over the whole complex plane, Astrophys. Space Sci., 107 (1984) 71-83.
-  M. R. Zaghloul and A. N. Ali, Algorithm 916: computing the Faddeyeva and Voigt functions, ACM Trans. Math. Software 38 (2011) 15:1-15:22.
-  W. Gautschi, Efficient computation of the complex error function, SIAM J. Numer. Anal., 7 (1970) 187-198.
-  W. B. Jones and W. J. Thron, Continued fractions in numerical analysis, Appl. Num. Math., 4 (1988) 143-230.
-  S. M. Abrarov and B. M. Quine, Master-slave algorithm for highly accurate and rapid computation of the Voigt/complex error function, J. Math. Research, 6 (2014) 104-119.
-  J. A. C. Weideman, Computation of the complex error function, SIAM J. Numer. Anal., 31 (1994) 1497-1518.
-  S. M. Abrarov and B. M. Quine, Efficient algorithmic implementation of the Voigt/complex error function based on exponential series approximation, Appl. Math. Comput. 218 (2011) 1894-1902.
-  S. M. Abrarov and B. M. Quine, On the Fourier expansion method for highly accurate computation of the Voigt/complex error function in a rapid algorithm, arXiv:1205.1768.
-  T. M. Karbach, G. Raven and M. Schiller, Decay time integrals in neutral meson mixing and their efficient evaluation, arXiv:1407.0748.
-  B. H. Armstrong, Spectrum line profiles: the Voigt function, J. Quant. Spectrosc. Radiat. Transfer. 7 (1967) 61-88.
-  H. Amamou, B. Ferhat and A. Bois, Calculation of the Voigt function in the region of very small values of the parameter a where the calculation is notoriously difficult, Amer. J. Anal. Chem., 4 (2013) 725-731.
-  The Matlab source code for computation of the Voigt/complex error function can be downloaded here: Matlab Central, file ID: #47801, submitted on Sept. 10, 2014.
-  G. B. Rybicki, Dawson’s integral and the sampling theorem, Comp. Phys., 3 (1989) 85-87.
-  J. H. McCabe, A continued fraction expansion with a truncation error estimate for Dawson’s integral, Math. Comp. 127 (1974) 811-816.
-  W. J. Cody, K. A. Paciorek and H. C. Thacher, Chebyshev approximations for Dawson’s integral, Math. Comp. 24 (1970) 171-178.