From
Krishna Myneni@21:1/5 to
All on Tue May 10 21:36:51 2022
I discovered a serious bug in my Forth code for computing the Voigt
function, which is a convolution of a Gaussian probability density and a Lorentzian probability density. This code is included in the 32/64-bit
kForth packages, under forth-src/fsl/extras/
The problem is with initializing the widths of the Gaussian and
Lorentzian distributions, in preparation for using the words K(X,Y) or
VOIGT -- the latter computes a properly normalized probability density
function with abscissas in the same units as the supplied widths. Two
different methods of initialization are provided:
1) SET-FWHM-WIDTHS ( F: Gamma_G Gamma_L -- )
2) SET-SD-HWHM-WIDTHS ( F: sigma gamma_L -- )
The first, SET-FWHM-WIDTHS has a bug in initializing intermediate
quantities used by the words K(X,Y) and VOIGT. Gamma_G and Gamma_L are
the full width at half maxima (FWHM) for the Gaussian and Lorentzian distributions.
The second, SET-SD-HWHM-WIDTHS does not have any known problems. It sets
the widths based on "sigma", the standard deviation of the Gaussian distribution, and the half width at half maximum (HWHM) for the
Lorentzian distribution.
The bug in SET-FWHM-WIDTHS has been fixed, and an update of voigt.4th
has been pushed to the kForth-64 distribution. Beyond the automated test
code within the file, I will perform additional validation of the fix
before pushing it out to the 32-bit kForth distributions. The automated
test code for voigt.4th may be run using the following loader under kForth.
\ test-voigt.4th
include ans-words
include modules
include fsl/fsl-util
include fsl/complex
include fsl/adaptint
include fsl/extras/zwofz
\ Turn on testing for subsequently loaded modules containing test code
true to test-code?
include fsl/extras/voigt
--
Krishna Myneni
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)