Post Reply 
Gamma Function Using Spouge's Method
12-18-2013, 12:55 AM (This post was last modified: 08-05-2016 06:48 AM by Namir.)
Post: #1
Gamma Function Using Spouge's Method
Gamma Function using Spouge's method.

Memory Map

R00 = x and = x-1
R01 = a
R02 = CHS
R03 = Sum
R04 = I
R05 = sqrt(2*pi)
R06 = integer part of I

Implementation

Code:
1 LBL "GAMMA"
2 LBL A
3 "X?"
4 PROMPT
5 1
6 -
7 STO 00
8 12.5
9 STO 01        # a = 12.5
10 1
11 STO 02        # CHS = 1
12 STO 03        # Sum = 1
13 2
14 PI
15 *
16 SQRT
17 STO 05        # sqrt(2*pi)
18 1.012
19 STO 04        # set up loop control variable
20 LBL 00        # start the loop
21 RCL 02
22 RCL 05
23 /
24 RCL 04
25 INT
26 STO 06
27 1
28 -
29 FACT
30 /
31 RCL 01
32 RCL 06
33 -
34 RCL 06
35 0.5
36 -
37 Y^X
38 *
39 RCL 01
40 RCL 07
41 -
42 EXP
43 *
44 RCL 06
45 RCL 00
46 +
47 /
48 STO+ 03            # Sum = Sum + C/(X+I)
49 RCL 02
50 CHS
51 STO 02        # CHS = -CHS
52 ISG 04        # end of loop
53 GTO 00
54 RCL 00
55 RCL 01
56 +
57 STO 06
58 RCL 00
59 0.5
60 +
61 Y^X
62 RCL 06
63 EXP
64 /
65 RCL 05
66 *
67 RCL 03
68 *
69 "GAMA="
70 ARCL X
71 PROMPT
72 GTO A
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Gamma Function Using Spouge's Method - Namir - 12-18-2013 12:55 AM



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