Gamma and Factorial for 10C/12C/12CP (thread hijack)



#2

Quote:
Out of context (i.e. calculator nerd bashing), I found it quiet funny. Especially because I got a calculator for Christmas and then proceeded to write a Gamma function for it. Details here: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=145337#145337.

Egan, in original 12C post you use the following to approximate the factorial:

x! = x^x*sqrt(2PIx)*e^(1/[12x + 2/(5x + 5/4x)] - x) 

Very elegant, with simple constants, and seems to work pretty well--indeed for calculator use with limited steps it is hard to get much better, especially if you use the shift-divide correction for the smaller arguments.

But I notice that it is a slight variation of a Stieltjes continued fraction. (stieltjes3 at Peter Luschny's site is the analagous formula.) The only difference is that in the version I know and which I can find on on Viktor Toth's site, the innermost term is actually 53/(42x).

I am curious whether you made the choice to approximate 53/42 by 5/4 yourself, or did you see another version of the formula on an earlier version of Viktor's site? I have to admit that deciding on the slight modification of that term is very wise, especially on the 10C and 12C where every digit is a keystroke.

I am kind of preoccupied myself with computing gamma on calculators that don't have it for noninteger values, so I am curious on the provenance of the formula you chose. (Right now I am experimenting with a variation of the Windschitl formula, but I think it takes more steps without any huge improvement in accuracy. With a 10 or 12 digit calculator, rounding error becomes significant quickly and mitigates the benefit of adding too many correction terms!)

Les


#3

Quote:
I am curious whether you made the choice to approximate 53/42 by 5/4 yourself, or did you see another version of the formula on an earlier version of Viktor's site?

IIRC, it was another version.
Quote:
I am kind of preoccupied myself with computing gamma on calculators that don't have it for noninteger values, so I am curious on the provenance of the formula you chose. (Right now I am experimenting with a variation of the Windschitl formula, but I think it takes more steps without any huge improvement in accuracy. With a 10 or 12 digit calculator, rounding error becomes significant quickly and mitigates the benefit of adding too many correction terms!)

I look forward to your discoveries.

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-10C Series Family Photo Max Stone 5 591 10-24-2013, 10:31 PM
Last Post: Eddie W. Shore
  Factorial misbehavior Han 10 688 10-09-2013, 02:36 AM
Last Post: Ed Hodapp
  HP15c continued fraction for Ln(Gamma) Tom Grydeland 0 241 09-30-2013, 05:48 AM
Last Post: Tom Grydeland
  HP Prime emulator: Gamma function Stephan Matthys 28 1,636 08-21-2013, 04:52 PM
Last Post: Namir
  What is the Gamma approximation you use? Namir 21 1,340 08-05-2013, 07:14 AM
Last Post: Namir
  10C, 11C, 12C logos on The Auction Site Peter Murphy (Livermore) 0 250 06-14-2013, 11:24 PM
Last Post: Peter Murphy (Livermore)
  [wp34s] Say thank you thread RalfGeiger 11 762 04-08-2013, 10:42 PM
Last Post: Eduardo Dueñez
  SandMath routine of the week: Inverse Gamma Function Ángel Martin 39 2,415 03-24-2013, 08:19 AM
Last Post: peacecalc
  HP41C: Factorial (kind of) in MCODE Frido Bohn 7 604 05-26-2012, 09:18 AM
Last Post: Frido Bohn
  [wp34s] Incomplete Gamma on the wp34s Les Wright 18 1,169 12-06-2011, 11:07 AM
Last Post: Namir

Forum Jump: