Post Reply 
(12C) ~Γ(x+1)
12-11-2017, 01:27 AM (This post was last modified: 12-12-2017 04:29 PM by Gerson W. Barbosa.)
Post: #1
(12C) ~Γ(x+1)
01 ENTER
02 ENTER
03 ENTER
04 7
05 2
06 *
07 2
08 5
09 +
10 *
11 1
12 0
13 +
14 1/x
15 1
16 +
17 *
18 8
19 *
20 1
21 6
22 12/
23 +
24 3
25 3
26 12*
27 LN
28 5
29 8
30 √x
31 /
32 *
33 √x
34 x<>y
35 ENTER
36 y^x
37 *
38 x<>y
39 e^x
40 /
41 GTO 00

0 < x < 56.3783

1 R/S -> 1.000003256
5.5 R/S -> 287.8853205
64 * 10395 / ENTER * -> 3.141593586



PS: For maximum range do the following modification:


...
36 LN
37 1
38 -
39 *
40 e^x
41 *
42 GTO 00
Find all posts by this user
Quote this message in a reply
12-11-2017, 02:19 AM (This post was last modified: 12-11-2017 02:23 PM by Gerson W. Barbosa.)
Post: #2
RE: (12C) ~Γ(x+1)
The 12C program is more obsfuscated than it need be because I was trying to save one step or two, which I could not. Here is an equivalent 32S II listing, for the sake of clarity:

G01 LBL G
G02 ENTER
G03 ENTER
G04 ENTER
G05 36
G06 *
G07 12.5
G08 +
G09 *
G10 5
G11 +
G12 1/x
G13 2
G14 +
G15 *
G16 3
G17 1/x
G18 +
G19 PI
G20 *
G21 SQRT
G22 x<>y
G23 ENTER
G24 y^x
G25 *
G26 x<>y
G27 e^x
G28 /
G29 RTN

CK=AE97 053.0


This is based on formula 27 here, slightly modified to improve accuracy.

PS: These make things more clear:

Plot [(√(((2+1/(36*x^2+25/2*x+5))*x+1/3)*π)*x^x/e^x - Γ(x+1))/Γ(x+1)], x=1/100..1

Plot [(√(((2+1/(36*x^2+25/2*x+5))*x+1/3)*π)*x^x/e^x - Γ(x+1))/Γ(x+1)], x=1..60

Now, let us compare the latter result with the one given by the original formula:

Plot [(√((2*x+1/3)*π)*x^x/e^x - Γ(x+1))/Γ(x+1)], x=1..60
Find all posts by this user
Quote this message in a reply
12-11-2017, 01:58 PM
Post: #3
RE: (12C) ~Γ(x+1)
(12-11-2017 02:19 AM)Gerson W. Barbosa Wrote:  This is based on formula 27 here, slightly modified to improve accuracy.

Maybe you should change the final steps where xx is divided by ex. Since both terms are calculated separately especially the first one may cause an overflow much earlier than neccessary. What about (x/e)x? Or maybe you have an even better idea?!

Dieter
Find all posts by this user
Quote this message in a reply
12-11-2017, 02:15 PM
Post: #4
RE: (12C) ~Γ(x+1)
(12-11-2017 01:58 PM)Dieter Wrote:  
(12-11-2017 02:19 AM)Gerson W. Barbosa Wrote:  This is based on formula 27 here, slightly modified to improve accuracy.

Maybe you should change the final steps where xx is divided by ex. Since both terms are calculated separately especially the first one may cause an overflow much earlier than neccessary. What about (x/e)x? Or maybe you have an even better idea?!

Dieter

Currently run out of good ideas here. Whatever you may suggest to improve accuracy or extended the range is much appreciated. Rewriting of the 12C program for speed is also welcome.

Thank you for your interest!

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




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