NAME

voigt - Voigt's function, convolution of Gaussian and Lorentzian

SYNOPSIS

#include <cerf.h>

double voigt ( double x, double sigma, double gamma );

DESCRIPTION

The function voigt returns Voigt's convolution

voigt(x,sigma,gamma) = integral G(t,sigma) L(x-t,gamma) dt

of a Gaussian

G(x,sigma) = 1/sqrt(2*pi)/|sigma| * exp(-x^2/2/sigma^2)

and a Lorentzian

L(x,gamma) = |gamma| / pi / ( x^2 + gamma^2 ),

with the integral extending from -infinity to +infinity.

If sigma=0, L(x,gamma) is returned. Conversely, if gamma=0, G(x,sigma) is returned.

If sigma=gamma=0, the return value is Inf for x=0, and 0 for all other x. It is advisable to test input arguments to exclude this irregular case.

ACCURACY

Errors are given in units of eps = 2^-53 = 1.1e-16, as relative deviations from high-precision reference values.

voigt is computed as Re w(z) / (sqrt(2 pi) sigma) from w_of_z(3), which controls the relative error of the modulus |w|, but not of its real part separately. Around the line center, both are of the same order, and the relative error of voigt was found below 7 eps for |x| < 2 sigma and below 16 eps for |x| < 3 sigma, for gamma between 1e-10 and 1e3 sigma.

In the wings, |x| >> sigma, the Lorentzian tail dominates, and Re w is smaller than |w| by a factor of about gamma/|x|. The relative error of voigt grows by the inverse factor and can reach the order of (|x|/gamma) eps: for |x| < 10 sigma and gamma > 1e-9 |x|, up to 7e8 eps, i.e. a relative error of 8e-8, was found at x = 7.5 sigma, gamma = 1e-8 sigma. For |x| > 10 sigma, where the asymptotic expansion of w is used, the loss is smaller: up to 1.5e4 eps at x = 10 sigma, and below 6 eps for 15 sigma < |x| < 100 sigma. For gamma < 1e-9 |x|, w is obtained from a first-order expansion around the real axis, and the relative error of voigt is about 2.5 (x/sigma)^2 eps.

REFERENCES

Formula (7.4.13) in Abramowitz & Stegun (1964) relates Voigt's convolution integral to Faddeeva's function w_of_z, upon which this implementation is based:

voigt(x,sigma,gamma) = Re[w(z)] / sqrt(2*pi) / |sigma|

with

z = (x+i*|gamma|) / sqrt(2) / |sigma|.

SEE ALSO

voigt_hwhm(3)

Related complex error functions: w_of_z(3), dawson(3), cerf(3), erfcx(3), erfi(3).

Homepage: https://jugit.fz-juelich.de/mlz/lib/cerf

AUTHOR

Joachim Wuttke, Forschungszentrum Juelich.

CONTACT

Please report bugs to the maintainer:

Joachim Wuttke <j.wuttke@fz-juelich.de>

COPYING

Copyright (c) 2013-2025 Forschungszentrum Juelich GmbH

Software: MIT License.

This documentation: Creative Commons Attribution Share Alike.