Dieter Kaiser | 4 Sep 23:45

Complex Bigfloats for the Gamma function

I have added support for Complex Bigfloat values to the Gamma function. With
this extension the Gamma function would have complete numerical support.

With Complex Bigfloats for the Gamma function it is possible to support complete
Complex Bigfloat evaluation for the Exponential Integral E(n,z) too.

I have rewritten the functions bbfac and cbfac in Lisp and called them
bfloat-factorial and complex-bfloat-factorial. What do you think? Should we use
the rewritten Lisp functions and not the Maxima functions?

I have tested the Gamma function with Bigfloats up to a precision of 64 digits
against functions.wolfram.com and against the original Maxima functions bffac
and cbffac. 

Both GCL 2.6.8 and CLISP 2.46 have no problems. The testsuite runs without
errors.

Dieter Kaiser

Index: csimp2.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/csimp2.lisp,v
retrieving revision 1.21
diff -u -r1.21 csimp2.lisp
--- csimp2.lisp   14 Feb 2008 01:31:37 -0000   1.21
+++ csimp2.lisp   4 Sep 2008 21:18:38 -0000
@@ -180,12 +180,17 @@
     (jr ($realpart j))
     (ji ($imagpart j)))
     (cond ((floatp j) (gammafloat j))
(Continue reading)

Raymond Toy | 9 Sep 17:26
Favicon

Re: Complex Bigfloats for the Gamma function

Dieter Kaiser wrote:
> I have added support for Complex Bigfloat values to the Gamma function. With
> this extension the Gamma function would have complete numerical support.
> 
> With Complex Bigfloats for the Gamma function it is possible to support complete
> Complex Bigfloat evaluation for the Exponential Integral E(n,z) too.
> 
> I have rewritten the functions bbfac and cbfac in Lisp and called them
> bfloat-factorial and complex-bfloat-factorial. What do you think? Should we use
> the rewritten Lisp functions and not the Maxima functions?

As best as I can tell, you've done a very straightforward translation of
the original Maxima implementation.  Does this really make much
difference?  I would think we could make it quite a bit faster if we
used the "native" bfloat operations instead of using mul/add which call
the simplifier.  (But maybe the major cost is calling $bern?.  I didn't
measure it.)

Also, do you know the algorithm used?  It looks like the asymptotic
series for log(gamma(z)) (see A&S 6.1.40).

Can't we arrange it to autoload bffac.mac when needed?

Ray
Dieter Kaiser | 9 Sep 20:37

Re: Complex Bigfloats for the Gamma function

-----Ursprüngliche Nachricht-----
Von: raymond.toy <at> ericsson.com [mailto:raymond.toy <at> ericsson.com] 

> As best as I can tell, you've done a very straightforward translation of
> the original Maxima implementation.  Does this really make much
> difference?  I would think we could make it quite a bit faster if we
> used the "native" bfloat operations instead of using mul/add which call
> the simplifier.  (But maybe the major cost is calling $bern?.  I didn't
> measure it.)

> Also, do you know the algorithm used?  It looks like the asymptotic
> series for log(gamma(z)) (see A&S 6.1.40).

> Can't we arrange it to autoload bffac.mac when needed?

You are right. It is a straightforward translation. The alternative is to call
cbffac. The point is that the Gamma function must support the Complex Bigfloat
to allow further work on other special functions.

By the way, I have studied the Complex Bigfloat routines suggested by David
Billinghurst in a post he sent on January 2006 to the mailing list. Perhaps this
routines could be a starting point for more "native" bigfloat implementation of
Complex Bigfloat algorithm.

Dieter Kaiser

Gmane