Post Reply 
(12C Platinum) GAMMA FUNCTION
07-03-2019, 07:58 AM (This post was last modified: 07-03-2019 08:42 AM by Gamo.)
Post: #1
(12C Platinum) GAMMA FUNCTION
This program was adapted form HP-19C Solutions Handbook page 31

[Reference: Gamma Function, John Ulissides. "65 Notes," V 3 N 10, p. 37.]

As stated in the handbook this program approximates the gamma
function for 0<X≤61 with eight digit accuracy over most of the range.

In this case this program use less PI significant digit than the 19C build in PI
function so this program will give out the most to five digit accuracy.

------------------------------

Equation:

GAMMA(x) = e [LN(√2Pi/X) + X (LN(X) - X + A)]

Where A = [1- 1/30(X^2) + 1/105(X^4))(1/12(X))]

-------------------------------

Example: FIX 5

1!
1 [R/S] display 1.00000

0.5!
.5 [R/S] display 1.77245

5.25!
5.25 [R/S] display 35.21161

7!
7 [ENTER] 1 [+] display 8 [R/S] display 5040.00021

------------------------------
Program: HP-12C Platinum on RPN mode
Code:

001 STO 0
002  3
003  5
004  5
005 ENTER
006  1
007  1
008  3
009  ÷
010 STO 2
------------
011 RCL 0
012  9
013  +
014 ENTER
015 1/x
016 X^2
017 ENTER
018 X^2
019  3
020  ,
021  5
022  ÷
023  -
024  3
025  0
026  ÷
027  1
028  -
029 X<>Y
030  1
-----------
031  2
032  x
033  ÷
034  +
035 X<>Y
036 ENTER
037 LN
038  x
039  -
040 X<>Y
------------
041 RCL 2
042  ÷
043  2
044  ÷
045 √x
046 LN
047  +
048 CHS
049 e^x
050 STO 1
-----------
051 CLx
052  9
053  -
054 STO÷1
055  1
056  +
057 X<>Y
058 X≤Y
059 GTO 062
060 X<>Y
061 GTO 054
062 RCL 1

Gamo
Find all posts by this user
Quote this message in a reply
Post Reply 




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