Faddeeva Package: complex error functions

版本 1.5.0.0 (50.1 KB) 作者: Steven G. Johnson
C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args
3.7K 次下载
更新时间 2012/12/17

查看许可证

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 版本兼容性
创建方式 R2012a
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

启发作品: Voigt model fit

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
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