# [Maxima] Implementation of Gamma functions

Dieter Kaiser drdieterkaiser at web.de
Fri Sep 5 16:56:16 CDT 2008

```I have started to implement support for the Incomplete Gamma function. Maxima
only knows the symbols gammaincomplete and gammagreek.

I have already finished the routines for the numerical evaluation of the
Incomplete Gamma function for Float, Complex float and Bigfloat. Now I am
working on the routines for Complex Bigfloats. I have used again an expansion in
a series or continued fractions for the Regularized Incomplete Gamma function.

In principle it is not necessary to implemenent a new algorithm. We can use the
routines for the Exponential Integral E because gamma(a,z) =
z^a*expintegral_e(1-a,z). But it is interessting to see that both algorithm
converge to every desired accurracy and give correct and equivalent results.

Because the different Gamma functions are interconnected it would be possible to
implement the following functions:

Incomplete Gamma function (The upper tail of the Gamma Incomplete function.)
Complement of the Incomplete Gamma function
Generalized Incomplete Gamma function
Regularized Incomplete Gamma function
Generalized Regularized Incomplete Gamma function

Perhaps the names could be:

gamma_incomplete(a,z)
gamma_greek(a,z)
gen_gamma_incomplete(a,z1,z2)
reg_gamma_incomplete(a,z)
gen_reg_gamma_incomplete(a,z1,z2)

Or we could use names like

gamma_incomplete(a,z)
gamma_greek(a,z)                 = 1 - gamma_incomplete(a,z)
gamma_incomplete_gen(a,z1,z2)    = gamma_incomplete(a,z1)-gamma_incomplete(a,z2)
gamma_incomplete_reg(a,z)        = gamma_incomplete(a,z)/gamma(a)
gamma_incomplete_gen_reg(a,z1,z2)= gamma_incomplete_gen(a,z1,z2)/gamma(a)

The second scheme has the advantage that the main name is always at the
beginning. You can see that in principle the Gamma function and the Incomplete
Gamma function are sufficient because they have simple interconnections to the
other functions.

Perhaps more interessting would be to implement a Log Gamma function and the
Inverse Gamma functions.

Dieter Kaiser

```