Post Reply 
Gamma function using Spouge Approximation
12-18-2013, 06:00 AM (This post was last modified: 06-13-2014 12:34 PM by Namir.)
Post: #1
Gamma function using Spouge Approximation
HP-67 Implementation

Memory Map

R0 = x and = x-1
R1 = a
R2 = CHS
R3 = Sum
R4 = Integer part of I, x+a
R5 = sqrt(2*pi)
RI = I

Listiing

Code:
1 LBL A
2 1
3 -
4 STO 0
5 1
6 2
7 .
8 5
9 STO 1 # a = 12.5
10 1
11 STO 3 # Sum = 1
12 CHS
13 STO 2 # CHS = -1
14 2
15 PI
16 *
17 SQRT
18 STO 5 # sqrt(2*pi)
19 12
20 CHS
21 STI # set up loop control variable
22 LBL 0 # start the loop
23 RCL 2
24 RCL 5
25 /
26 RCI
27 ABS
28 STO 4
29 1
30 -
31 N!
32 /
33 RCL 1
34 RCL 4
35 -
36 RCL 4
37 0
38 .
39 5
40 -
41 Y^X
42 *
43 RCL 1
44 RCL 4
45 -
46 EXP
47 * # calculate C
48 RCL 4
49 RCL 0
50 +
51 /
52 STO+ 3 # Sum = Sum + C/(X+I)
53 RCL 2
54 CHS
55 STO 2 # CHS = -CHS
56 ISZ # end of loop
57 GTO 0
58 RCL 0
59 RCL 1
60 +
61 STO 4
62 RCL 0
63 0.5
64 +
65 Y^X
66 RCL 4
67 EXP
68 /
69 RCL 5
70 *
71 RCL 3
72 *
73 R/S
74 GTO A
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Gamma function using Spouge Approximation - Namir - 12-18-2013 06:00 AM



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