Gamma Function by Stieltjes Continued Fraction
09-03-2015, 08:10 PM
Post: #3
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Gamma Function by Stieltjes Continued Fraction
(09-01-2015 10:31 PM)lcwright1964 Wrote:  I plan to port this directly and forthwith to the 67/97. I am keen on suggestions to save steps, because I would like to be able to fit the routine into the 49 steps of the HP33C/E or the HP25.

The original GMST routine can be coded in 48 steps on a HP25, including the suggested change of the sqrt(2 Pi) constant. This is easy since the '25 uses line addressing instead of labels. Also the X↔Y R↑ sequence can be replaced by two consecutive R↓ commands (AFAIK the HP25 offers no R↑).

However, with the additional accuracy improvement it's bit tricky to do it in 49 steps (50 is easy), but it can be done with the use of three data registers instead of one.

Code:
01  STO 0 02  STO/ 0 03  7 04  X<>Y 05  X≥Y? 06  GTO 11 07  STO* 0 08  1 09  + 10  GTO 05 11  STO 1 12  4 13  * 14  1/x 15  RCL 1 16  + 17  5 18  * 19  1/x 20  RCL 1 21  6 22  * 23  + 24  , 25  5 26  STO 2 27  X<>Y 28  / 29  e^x 30  RCL 1 31  e^x 32  / 33  RCL 1 34  RCL 1 35  RCL 2 36  - 37  LastX 38  * 39  y^x 40  * 41  LastX 42  * 43  RCL 2 44  Pi 45  / 46  √x 47  / 48  RCL 0 49  /

Instead of the stack this program uses R1 to store x, and R2 holds the constant 0.5 which is used several times. Since I am not sure whether starting a progam with R/S enables stack lift, the original 7 in the first line was moved and the 1 in R0 is provided by dividing x by x (which cannot be zero anyway). Since I do not own an HP25 I could not test all this, but I think it should work.

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-01-2015, 10:31 PM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-02-2015, 10:53 AM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-03-2015 08:10 PM RE: Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-04-2015, 01:54 AM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-04-2015, 06:29 AM RE: Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-04-2015, 06:32 PM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-05-2015, 05:49 AM RE: Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-05-2015, 09:55 PM RE: Gamma Function by Stieltjes Continued Fraction - Gerald H - 09-06-2015, 06:40 AM RE: Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-06-2015, 03:07 PM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-09-2015, 09:21 PM RE: Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-10-2015, 10:51 PM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-11-2015, 08:14 PM RE: Gamma Function by Stieltjes Continued Fraction - lcwright1964 - 09-13-2015, 02:06 AM RE: Gamma Function by Stieltjes Continued Fraction - Dieter - 09-13-2015, 01:55 PM

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