Re: SandMath routine of the week: Inverse Gamma Function Message #11 Posted by Gerson W. Barbosa on 16 Mar 2013, 9:41 p.m., in response to message #10 by Angel Martin
Hi 聲gel,
OVER is equivalent to RCL Y, but it's easier if you know where these constants and expression come from (see below *).
This can be a possible RPN equivalent for the first part of the program:
01 LBL "IGMMA"
02 STO 01
03 ENTER^
04 LN
05 ENTER
06 SQRT
07 2,21
08 *
09 RCL Y
10 ,16
11 *
12 +
13 ,194
14 +
15 /
16 /
17 2
18 X<=Y?
19 X<>Y
20 STO 00
21 LBL 00
...
Cheers,
Gerson.

(*) The following is part of a curve fitting made with help of an old version of
DataFit.
_{
Model Definition:
Y = x/(a+b*x+c*sqr(x))
Number of observations = 172
Number of missing observations = 0
Solver type: Nonlinear
Nonlinear iteration limit = 250
Diverging nonlinear iteration limit =10
Number of nonlinear iterations performed = 23
Residual tolerance = 0,0000000001
Sum of Residuals = 1,97982012453611E02
Average Residual = 1,1510582119396E04
Residual Sum of Squares (Absolute) = 0,071461272245453
Residual Sum of Squares (Relative) = 0,071461272245453
Standard Error of the Estimate = 2,05632625029686E02
Coefficient of Multiple Determination (R^2) = 0,9994754674
Proportion of Variance Explained = 99,94754674%
Adjusted coefficient of multiple determination (Ra^2) = 0,99946926
DurbinWatson statistic = 0,181006272327966
Regression Variable Results
Variable Value Standard Error tratio Prob(t)
a 0,194180061078165 6,75779102290044E02 2,873425065 0,00458
b 0,160140574611016 5,79167114529964E04 276,5014977 0,0
c 2,20860298743044 1,42205819324635E02 155,3103099 0,0

X Value Y Value Calc Y Residual % Error Abs Residual Min Residual Max Residual
1 0 0 0 0 0 0 0,09225268066 0,09044327801
2 0,6931471804 0,2310490602 0,3233017409 0,09225268066 39,92774547 0,09225268066
3 1,791759469 0,4479398673 0,5212429458 0,07330307854 16,36449084 0,07330307854
4 3,17805383 0,635610766 0,6848643811 0,0492536151 7,749021529 0,0492536151
5 4,787491743 0,7979152904 0,8263771459 0,02846185547 3,567027204 0,02846185547
6 6,579251212 0,9398930303 0,9517404203 0,01184739003 1,260504084 0,01184739003
7 8,525161361 1,06564517 1,064573069 0,001072101061 0,10060582 0,001072101061
...
167 691,1834011 4,114186911 4,091157824 0,02302908714 0,5597481991 0,02302908714
168 696,3073651 4,120161924 4,096382192 0,02377973199 0,5771552776 0,02377973199
169 701,4372638 4,126101552 4,101568196 0,02453335547 0,5945892306 0,02453335547
170 706,5730622 4,132006212 4,106716318 0,02528989421 0,6120487945 0,02528989421
171 857,9336698 4,289668349 4,241416568 0,04825178142 1,124837109 0,04825178142
172 1128,523771 4,514095084 4,423651805 0,09044327801 2,003574943 0,09044327801

}
In the X column, ln(InvGamma(x)); in the Y column, ln(InvGamma(x))/x. This was the best fit out of 57 models.
Edited: 16 Mar 2013, 9:52 p.m.
