[SciPy-User] error function with complex argument
Tue Oct 9 12:12:08 CDT 2012
09.10.2012 19:28, "Claas H. Köhler" kirjoitti:
> I have a question regarding the error function scipy.special.erf:
> Is it intended, that the erf of an imaginary argument yields a non-vanishing real-part?
> I get e.g.
> erf(1j)= 1.6504257587975431j
> erf(5j)= (1+8298273879.8992386j)
> The first result is what I would expect in accordance with Wolfram alpha. The second result, however,
> has a real part of unity. As far as I know, the real part of erf should always vanish for purely
> imaginary numbers.
> Any support would be appreciated.
The reason here is that the ye olde complex erf Fortran implementation
that Scipy has uses the asymptotic expansion (Abramowitz & Stegun
7.1.23) to compute large-argument values. The asymptotic series is for
erfc, and one always gets Re erf = 1 along the imaginary axis.
Of course, this is somewhat naive. While it does produce reasonable
relative accuracy as a complex number, the accuracy of the real and
imaginary parts separately is not necessarily OK near the imaginary axis.
The issue with Scipy here is twofold -- first, there are no better
existing special function libraries we could use, or at least I'm not
aware of them. Second, writing these from scratch takes time and
expertise and nobody has so far volunteered to do any work in this
More information about the SciPy-User