No BSD License  

Highlights from

5.0 | 8 ratings Rate this file 37 Downloads (last 30 days) File Size: 2.35 KB File ID: #3572 Version: 1.0



Paul Godfrey (view profile)


06 Jun 2003 (Updated )

Compute a very accurate Gamma function over the entire complex plane.

| Watch this File

File Information

A very accurate complex Gamma function valid over the entire complex plane. This function is more accurate than MATLAB's own real only Gamma function.


This file inspired Variable Order Derivatives.

MATLAB release MATLAB 6.0 (R12)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
21 Aug 2015 Karan Gill

Also worth mentioning that if you have the Symbolic Math Toolbox, you calculate the complex gamma function in double using it. Example:

>> double(gamma(sym(1+1i)))
ans =
0.4980 - 0.1549i

Comment only
24 Feb 2015 G. Merchant

Loss of accuracy in complex plane:

Using this routine:
gamma(-2-2e-7 i)=0.462366678321968 + 2499999.99999981i

Using backwards recursion:
gamma(0-2e-7 i)=-0.577215664901504 + 4999999.99999981i
gamma(-1-2e-7i)=gamma(-2e-7i)/(-1-2e-7i) =-0.577215664901504 + 4999999.99999981i
gamma(-2-2e-7i)=gamma(-1-2e-7i)/(-2-2e-7i)=0.461392167549202 + 2499999.99999982i

Note that the real part agree for only 2 digits. The second calculation based on backwards recursion agrees Mathematica and Fortran. Look for discussion on Google Groups by Krishna Myneni.
Is it possible to fix this issue?

Comment only
23 May 2012 Marzieh  
28 Oct 2011 Jacques Burrus

Thank you!

05 Jun 2009 Slimane Grine

Thanks. Very useful!

18 Jan 2009 Deepak

Deepak (view profile)

Its so lovely to see this function on the first search.
Extremely handy.
Please post some references as well for the theory.

10 Apr 2006 Matteo Borghi  
22 Mar 2006 Rudi Fruehwirth

Very useful!

31 Jan 2006 Bill Davidson

Thank you. Excellent. It is a handy function to have around.

09 Nov 2005 hugues de chatellus  

Contact us