Mofreh R Zaghloul*
Department of Physics, UAE
*Corresponding author: Mofreh R Zaghloul, Department of Physics, UAE
Submission: March 23, 2022;Published: June 29, 2022
Volume2 Issue2 June, 2022
We present a simple remedy for the loss-of-accuracy problem, near the real axis, in a widely used algorithm for the calculation of the Faddeyeva and Voigt functions. The reformed routine maintains the claimed accuracy of the algorithm over a wide and fine grid that covers all the domain of the real part, x, of the complex input variable, z=x+iy, and values for the imaginary part in the range yε[10-30, 1030].
Keywords: PV solar field; Shadow; Design parameters
Because of its applications in many fields of physics such as atmospheric radiative transfer, plasma spectroscopy, nuclear physics, nuclear magnetic resonance, etc, the analysis and evaluation of the complex probability function, commonly known as the Faddeyeva function, has gained a wide interest in the literature [1-18]. The function is defined mathematically as the scaled complementary error function for a complex variable and can, therefore, be expressed as,
where V and L are known as the real and imaginary “Voigt functions,” since V(x,y) is the Voigt line profile, used in spectroscopy and radiative transfer, ressulting from the convolution of the Gaussian profile (as a result of Doppler broadening) and a Lorentzian profile (result of pressure or collision broadening). The imaginary Voigt function L is also useful for various applications and needs to be taken into consideration as well. The fact that a closed form expression does not exist for the convolution integral defining the Voigt functions or for the closely related Faddeyeva function led to the development of a wide variety of algorithms to numerically evaluate the functions. These algorithms vary significantly in their accuracy and computational speed and the decision for a certain algorithm will depend on the particular application under consideration. One of the algorithms widely employed in the solution of practical problems requiring numerous evaluation of the complex probability function is the Humlíček’s w4 algorithm [6]. The algorithm is efficient for some applications tolerating low accuracy computations (10-4), however, as shown in the literature (see for example [11,18]) the w4 algorithm does suffer from a loss of its claimed accuracy near the real axis. It is also worth mentioning that Humlíček’s w4 algorithm is the basis of several other refinements (see for example [10-12,16,17]). In most of these references, Humlíček’s w4 algorithm is shown to be remarkably more efficient when the parameter x is a vector while y is a scalar. Even though, a brief survey and benchmarking tests by Schreier [17] considering practical aspects of Fortran and Python implementations demonstrated that programming language, compiler choice, and implementation details influence computational speed and that there is no unique ranking of algorithms. In this note we provide a simple reform to this problem where the reformed algorithm maintains the claimed accuracy of the algorithm over the whole domain of interest.
In Humlíček’s w4 algorithm, the x-y plane is divided into four regions where for each region an approximate expression is used in the form of a rational polynomial. The four regions used in the w4 algorithm are shown in (Figure 1). The borders for these regions are also summarized in the second column of (Table 1) below. The w4 algorithm calculates both the real and imaginary parts of the Faddeyeva function concurrently. A thorough investigation of the accuracy of the w4 code over all of its four regions, using algorithm-916 [18] as a reference, shows that the accuracy failure of the w4 code occurs for values of y<10-7 and values of x in Region II. (Figure 2) shows contour plots of the common logarithm (base 10) of the absolute values of the relative error, in the calculation of the real and imaginary parts of the Faddeyeva function, resulting from using the w4 algorithm with algorithm-916 [18] as a reference. As pointed out by Garcia [13] the damping parameter y, for the Lyman transitions of intergalactic HI spans a range of 9.3×10-9 (corresponding to higher order Lyman transitions) to 6.5×10-4 (corresponding to Lyα). Accordingly, this region in which the w4 algorithm loses its claimed accuracy is of practical interest to some applications.
Figure 1:The four regions in the x-y plane in the Humlíček’s original algorithm.
Table 1: Borders of the four regions in Humlíček’s original and reformed algorithms.
Figure 2: Contour plots of the absolute relative error resulting from using the w4 algorithm for calculating the real and imaginary parts of the Faddeyeva function with algorithm-916 [18] as a reference. The thick line in the left part shows the contour of relative error equals 10-4 where the region inside this contour is the region where Humlíček’s original algorithm loses its claimed accuracy.
Figure 3: The new four regions in the x-y plane in the Humlíček’s reformed algorithm.
the w4 algorithm near the x-axis exists in redefining the borders of one of the regions in the partitioning used in the original routine. The approximation proposed by Humlíček to be used in Region IV in the w4 algorithm is found to be very accurate for very small values of y. We propose using this expression for y≤10-6 and 5.5≤|x|+y<15.0 to overcome the loss-of-accuracy problem near the real axis. This means that Region IV will be extended to include this part of Region II as schematically shown in (Figure 3). The borders of the modified regions are given in the third column of (Table 1) where a simple modification of the borders of Region II is shown in boldface letters. This is a very simple and minor coding change to the original w4 algorithm that can be straightforwardly implemented to fix the above-mentioned accuracy problem in such a widely used algorithm. (Figure 4) shows contour plots similar to those in (Figure 2) but for results from using the reformed w4 algorithm where, as it can be seen, the claimed accuracy of the w4 algorithm is restored and the loss-of-accuracy problem is removed. (Figure 4) Contour plots of the common logarithm (base 10) of the absolute of the relative error resulting from using the reformed w4 algorithm for calculating the real and imaginary parts of the Faddeyeva function with algorithm-916 [18] as a reference.
Figure 4: Contour plots of the common logarithm.
A simple reform for treating the reported problem of lossof- accuracy near the real axis of Humlíček’s w4 algorithm is introduced. The reformed routine maintains the claimed accuracy of the algorithm over a wide and fine grid that covers all regions of interest.
© 2022 Mofreh R Zaghloul. This is an open access article distributed under the terms of the Creative Commons Attribution License , which permits unrestricted use, distribution, and build upon your work non-commercially.