Gamma Function by Stieltjes Continued Fraction
09-04-2015, 06:32 PM
Post: #6
 lcwright1964 Member Posts: 66 Joined: Jan 2014
RE: Gamma Function by Stieltjes Continued Fraction
Dieter, I like your rewrite so much, using registers and some other tweaks, that I have adopted it in toto for all of the units I am trying to program. Here is the HP41 version, where, again inspired by JMP, I use the synthetic registers M, N, and O in place of your 0, 1, and 2. It seems to run just as fast and works great:

Code:
  01 LBL "GMST"  02 STO M  03 ST/ M  04 7  05 X<>Y  06 LBL 01  07 X>Y?  08 GTO 02  09 ST* M  10 1  11 +  12 GTO 01  13 LBL 02  14 STO N  15 4  16 *  17 1/X  18 RCL N  19 +  20 5  21 *  22 1/X  23 RCL N  24 6  25 *  26 +  27 0.5  28 STO O  29 X<>Y  30 /  31 E^X  32 RCL N  33 E^X  34 /  35 RCL N  36 RCL N  37 RCL O  38 -  39 LASTX  40 *  41 Y^X  42 *  43 LASTX  44 *  45 RCL O  46 PI  47 /  48 SQRT  49 /  50 RCL M  51 /  52 END

Once one gets rid of the three LBL steps and the END statement and adds a line to code .5, one is done to the 49 steps that fit perfectly into the HP33E/C or the HP25. I have a real 33C and Olivier's emulators on my Android and am keen to see how this works out.

Again, for anyone who wants to play with the program in V41, Free42, Emu42, or any of a number of compatible iPhone or Android emulators, I attach the RAW file. I didn't bother with a LIF or barcode file this time--anyone with the level of sophistication to turn to those already knows how to use hp41uc to compile the files themselves. Indeed, that is pretty well what you need to do to get a program into Emu41, which I use as a companion to PILBox.

Les

Attached File(s)