Function gives wrong results for high moduli input. For instance, using Maple ERF converted to DOUBLE (erfz2 function below):
>> z=3+2i; erfz2(z*i)/i, erfi(z)
ans =
8.6873 -20.8295i
ans =
8.6873 -20.8295i
>> z=7+7i; erfz2(z*i)/i, erfi(z)
ans =
-0.0561 + 1.0102i
ans =
7.3774e+024 +1.6269e+025i
1
01 Nov 2010
erfi function
Imaginary error function (could be complex) using matlab's incomplete gamma function gammainc
The program does not work as stated. When using complex z (i.e., not pure real, or pure imaginary), I get the following error:
Error using ==> gammainc
Inputs must be real, full, and double or single.
Error in ==> erfi at 19
ans=~isreal(x).*(-(sqrt(-x.^2)./(x+isreal(x))).*gammainc(-x.^2,1/2))+...
This also occurs for Example 2 provided with the code. I'm assuming it's a trivial problem since the figure above seems to correspond to what I would expect (look at the erfi article on Mathworld ). In case it's relevant, I'm using Matlab 7.10.0.499 (R2010a) (64-bit).
Comment only
01 Nov 2010
erfi function
Imaginary error function (could be complex) using matlab's incomplete gamma function gammainc
Comment only