• Re: Bug fix in FSL-based utility: voigt.4th

    From Krishna Myneni@21:1/5 to Krishna Myneni on Tue May 10 21:48:13 2022
    On 5/10/22 21:36, Krishna Myneni wrote:
    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.
    ...
    The bug in SET-FWHM-WIDTHS has been fixed, and an update of voigt.4th
    has been pushed to the kForth-64 distribution. ...

    Link to updated voigt.4th in the kForth-64 repo:

    https://github.com/mynenik/kForth-64/blob/master/forth-src/fsl/extras/voigt.4th

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • 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)