Rank: 4312 based on 24 downloads (last 30 days) and 1 file submitted
photo

Steven G. Johnson

E-mail
Company/University
MIT

Personal Profile:

 

Watch this Author's files

 

Files Posted by Steven G. Johnson
Updated   File Tags Downloads
(last 30 days)
Comments Rating
17 Dec 2012 Screenshot Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson error function, complex complementary..., faddeeva, voigt, voigt function, erf 24 4
  • 4.5
4.5 | 2 ratings
Comments and Ratings by Steven G. Johnson View all
Updated File Comments Rating
15 Dec 2012 Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson

It won't work with lcc, since that is a C compiler, not a C++ compiler. The failure to compile with Visual C++ is a bug, which is fixed in the latest release on my web site (and which should appear on Matlab Central shortly).

05 Nov 2012 Error function of complex numbers Extend the error function to the complex plane. Author: Marcel Leutenegger

Although this implementation is very good (and is competitive with Per's code in performance on my machine), note that it computes real(erf(z)) inaccurately near the imaginary z axis. e.g. real(erfz(1e-8 + 1i)) gives 3.1023...e-8, but the correct answer is 3.067...e-8 according to Mathematica.

See http://ab-initio.mit.edu/Faddeeva for an alternative (free/open-source) function that is a compiled MEX plugin (hence running several times faster than this code) which achieves around 13 digits of accuracy or more in both the real and imaginary parts in my tests.

29 Oct 2012 erfi function Imaginary error function (could be complex) using matlab's incomplete gamma function gammainc Author: Per Sundqvist

Note that an alternate way of computing erfi, which works for complex z, is to use the Faddeeva function (http://www.mathworks.com/matlabcentral/fileexchange/38787-faddeeva-function-scaled-complex-error-function), via erfi = @(z) -i * (exp(z.^2) .* Faddeeva_w(z) - 1) ... this seems to avoid the below-mentioned problems for large arguments, and is faster.

Comments and Ratings on Steven G. Johnson's Files View all
Updated File Comment by Comments Rating
28 Feb 2014 Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson Ian

One update I would really like to see in this package is the derivative functions, at least for W(z). As pointed out in Zaghloul and Ali, the derivative functions of W(z) (equations 21-23) become numerically unstable near dV/dx = 0 (V=real(W(z)), at the peak of the Voigt function. This can cause problems when trying to compute analytical Jacobians for doing nonlinear fits of the Voigt function to optical spectra.

Since you are already using the Zaghloul and Ali algorithm in this region, it would be helpful to also use their method to output a function, say Faddeeva_dw(z) = dV/dx + i*dL/dx (L=imag(W(z)). The corresponding y derivatives can then be trivially computed.

27 Feb 2014 Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson Ian

Works as advertised and is extremely fast.

12 Feb 2013 Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson Niklas

15 Dec 2012 Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson Steven G. Johnson

It won't work with lcc, since that is a C compiler, not a C++ compiler. The failure to compile with Visual C++ is a bug, which is fixed in the latest release on my web site (and which should appear on Matlab Central shortly).

11 Dec 2012 Faddeeva Package: complex error functions C++ MEX plugins to compute error functions (erf, erfc, erfi, erfcx, Faddeeva, ...) of complex args Author: Steven G. Johnson alan

Hello, Love this program. I have it up and running on my mac to simulate voigt broadening. Im trying to add this functionality to a lab computer running win32 matlab 7.12.0 (R2011a), but I cannot successfully compile with mex.

With Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2011a\sys\lcc: lcc preprocessor error: .\Faddeeva.hh:30 .\Faddeeva_mex.cc:35 Faddeeva_w_mex.cc:3 Could not find include file complex

full verbose: http://pastebin.com/YyLYYe8C

With Microsoft Visual C++ 2010 Express in C:\Program Files\Microsoft Visual Studio 10.0: Faddeeva.cc Faddeeva.cc(184) : error C2124: divide or mod by zero Faddeeva.cc(822) : error C3861: 'copysign': identifier not found C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Compile of 'Faddeeva.cc' failed.

full verbose: http://pastebin.com/K4LPd9FN

The only instances of complex.h are in a pythonwx folder not related to matlab. I see that it was released for R2012a. Does the package need a specific C++ compiler?

Contact us