Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imaginary error function in c++

Tags:

c++

math

Is there a GPL library or a piece of code freely available that implements the imaginary error function:

erfi(x)=-i*erf(i*x)

where x is any complex number (or at least real) and i is the imaginary unit?

like image 889
yannick Avatar asked Dec 16 '22 21:12

yannick


1 Answers

A free/open-source C++ implementation of all of the usual error functions for real and complex arguments, including both erfi and a scaled erfi (to cancel erfi's exponential growth) (the Dawson function), including optimizations for erfi of real arguments, is available at http://ab-initio.mit.edu/Faddeeva

(Note that this implementation is actually used in the upcoming version 0.12 of SciPy, replacing the complex-erf code in earlier versions which had accuracy problems: http://projects.scipy.org/scipy/ticket/1207)

(Unfortunately, evaluating special functions of complex arguments isn't as simple as plugging complex numbers into code for real arguments, which is why the templating in Boost's real-valued erf is of no help here.)

like image 103
Steven G. Johnson Avatar answered Dec 27 '22 14:12

Steven G. Johnson