Gamma Function Using Spouge's Method
08-22-2015, 09:57 AM (This post was last modified: 08-24-2015 08:42 AM by lcwright1964.)
Post: #17
 lcwright1964 Member Posts: 66 Joined: Jan 2014
RE: Gamma Function Using Spouge's Methjod
Well I did find that Maple worksheet. Looks like I basically ported Viktor's C++ code for Godfrey's method and took advantage of Maple's easy to use linear algebra capabilities.

Unfortunately I did NOT expand things out and collect terms as Viktor did (and you used) so my result looks a bit different.

My preliminary conclusion is that going with Pugh's recommendation for the arbitrary parameter one can keep the relative error the same (at least 10 digits good for positive real arguments as long as one computes in 13-digit precision), with one fewer terms in the series.

Here is my result with the coefficients presented to 13 significant digits:

(0.9446965718570e-2 + 1.367185253712/z - 1.839535625335/(z+1) + .6838535775175/(z+2) - 0.6542905498252e-1/(z+3) + 0.6572071053721e-3/(z+4)) * ((z+5.081000210223)/exp(1))^(z-1/2)

Input has been adjust to compute Gamma(z), not Gamma(z+1) or z!.

The scaling by e in the second factor before exponentiation should prevent overflow when other formulas tend to for larger arguments, but I have not rigourously examined that.

In this case the arbitrary parameter recommended by Pugh is 5.58100021022. In the original paper Lanczos does not present an example with n = 5 (so 6 coefficients) for comparison.

In the version you use now you embed 7 12-digit coefficients and one 2-digit parameter--5.5 (from 5 + .5). Here you embed 6 13-digit coefficients and one 13-digit parameter. And there is one less series term. So this should be faster and smaller, at least a little.

I should work on doing what Viktor does so as to produce a polynomial divided by a product, etc. In the meantime, this is what I have.

I work in Mathematica more these days so I should see what happens there.

Les
 « Next Oldest | Next Newest »

 Messages In This Thread Gamma Function Using Spouge's Method - Namir - 12-18-2013, 12:55 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-07-2015, 07:23 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-12-2015, 04:03 AM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-12-2015, 05:39 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-12-2015, 06:03 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-12-2015, 09:11 PM RE: Gamma Function Using Spouge's Methjod - Ángel Martin - 08-19-2015, 08:56 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-20-2015, 11:36 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-20-2015, 07:49 PM RE: Gamma Function Using Spouge's Methjod - Ángel Martin - 08-21-2015, 09:48 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-22-2015, 02:09 AM RE: Gamma Function Using Spouge's Methjod - Ángel Martin - 08-22-2015, 08:35 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-22-2015, 08:58 AM RE: Gamma Function Using Spouge's Methjod - Ángel Martin - 08-22-2015, 10:45 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-19-2015, 05:32 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-20-2015, 12:36 PM RE: Gamma Function Using Spouge's Methjod - Thomas Klemm - 08-20-2015, 08:22 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-22-2015 09:57 AM RE: Gamma Function Using Spouge's Methjod - Ángel Martin - 08-22-2015, 01:17 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-22-2015, 11:51 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-23-2015, 09:01 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-24-2015, 08:12 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-24-2015, 09:23 AM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-24-2015, 07:32 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-24-2015, 08:40 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-24-2015, 11:14 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-25-2015, 01:56 AM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-25-2015, 06:48 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-27-2015, 11:21 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 09-15-2015, 06:43 PM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-25-2015, 11:29 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-26-2015, 09:50 AM RE: Gamma Function Using Spouge's Methjod - lcwright1964 - 08-26-2015, 12:50 PM RE: Gamma Function Using Spouge's Methjod - Dieter - 08-26-2015, 05:08 PM

User(s) browsing this thread: 1 Guest(s)