No BSD License  

Highlights from
erfi function

2.33333

2.3 | 3 ratings Rate this file 21 Downloads (last 30 days) File Size: 840 Bytes File ID: #18238
image thumbnail

erfi function

by Per Sundqvist

 

06 Jan 2008 (Updated 16 Jan 2008)

Imaginary error function (could be complex) using matlab's incomplete gamma function gammainc

| Watch this File

File Information
Description

Imaginary error function, as it is defined in Mathematica erfi(z)==erf(iz)/i (z could be complex) using the incomplete gamma function in matlab: gammainc

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
02 Jun 2010 Ian

-Good work with this function Per!!
-While preforming an optimisation using this function. A bug in MATLAB 7.10 (R2010a) was reported. The function enters an infinite loop when calling gamminc(x,a) with x<0 and abs(x)>>a. They are working to fix this in future releases.
kind regards,
Ian Gregory, Sydney.

06 Jul 2010 kinor

Hi Ian,

thank your for the hint

and you of course for sharing the function Per!

best

kinor

01 Nov 2010 PLH  
01 Nov 2010 PLH

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).

19 May 2011 Marcelo Pisani

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

21 Jun 2011 Mohamed Yassin OUKILA

what is erfz2?

Please login to add a comment or rating.
Updates
16 Jan 2008

Special case when x is real and erfi(0)=0 and for x>6 an asymptotic expression is used.

Tag Activity for this File
Tag Applied By Date/Time
imaginary error function Per Sundqvist 22 Oct 2008 09:42:06
complex Per Sundqvist 22 Oct 2008 09:42:06
gaussian Per Sundqvist 22 Oct 2008 09:42:06
integral Per Sundqvist 22 Oct 2008 09:42:06
complex Abdolhamid Shoory 25 Nov 2008 11:56:35
complex wang 23 Aug 2011 05:28:30

Contact us at files@mathworks.com