Faddeeva Package: complex error functions
C++ source code for compiled plugins (MEX files) to compute various error functions for complex arguments:
** Faddeeva_erf(z) -- the error function
** Faddeeva_erfc(z) = 1 - erf(z) -- complementary error function
** Faddeeva_erfi(z) = -i erf(iz) -- imaginary error function
** Faddeeva_erfcx(z) = exp(z^2) erfc(z) -- scaled complementary error function
** Faddeeva_w(z) = exp(-z^2) erfc(-iz) -- Faddeeva function
** Faddeeva_Dawson(z) = 0.5 sqrt(pi) exp(-z^2) erfi(z) -- Dawson function
From e.g. the Faddeeva function, one can also obtain the Voigt functions and other related functions.
Assuming you have a C++ compiler (and have configured it in MATLAB with mex -setup), compile by running the included Faddeeva_build.m script in MATLAB:
Faddeeva_build
All of the functions have usage of the form:
w = Faddeeva_w(z)
or optionally Faddeeva_w(z, relerr), where relerr is a desired relative error (default: machine precision). z may be an array or matrix of complex or real numbers.
This code may also be downloaded from
http://ab-initio.mit.edu/Faddeeva
along with documentation and other versions. As described in the source code, this implementation uses a combination of algorithms for the Faddeeva function: a continued-fraction expansion for large |z| [similar to G. P. M. Poppe and C. M. J. Wijers, "More efficient computation of the complex error function," ACM Trans. Math. Soft. 16 (1), pp. 38–46 (1990)], and a completely different algorithm for smaller |z| [Mofreh R. Zaghloul and Ahmed N. Ali, "Algorithm 916: Computing the Faddeyeva and Voigt Functions," ACM Trans. Math. Soft. 38 (2), 15 (2011).]. Given the Faddeeva function, we can then compute the other error functions, although we must switch to Taylor expansions and use other tricks in certain regions of the complex plane to avoid cancellation errors or other floating-point problems.
Cita come
Steven G. Johnson (2025). Faddeeva Package: complex error functions (https://www.mathworks.com/matlabcentral/fileexchange/38787-faddeeva-package-complex-error-functions), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
- MATLAB > Mathematics > Elementary Math > Special Functions > Error Functions >
- Mathematics and Optimization > Symbolic Math Toolbox > Mathematics > Calculus >
Tag
Riconoscimenti
Ispirato: Voigt model fit
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
Versione | Pubblicato | Note della release | |
---|---|---|---|
1.5.0.0 | portability fixes, slight accuracy improvements |
||
1.4.0.0 | Now includes separate plugins for all of the error functions. |
||
1.3.0.0 | note how to compute erfi using Faddeeva function |
||
1.1.0.0 | Improve accuracy in Re[w(z)] taken by itself. |
||
1.0.0.0 |