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.
인용 양식
Steven G. Johnson (2024). Faddeeva Package: complex error functions (https://www.mathworks.com/matlabcentral/fileexchange/38787-faddeeva-package-complex-error-functions), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Mathematics > Elementary Math > Special Functions > Error Functions >
- Mathematics and Optimization > Symbolic Math Toolbox > Mathematics > Calculus >
태그
도움
도움 준 파일: Voigt model fit
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!