Post Reply 
(HP65) Factorial and Gamma Function
10-21-2017, 01:21 PM (This post was last modified: 10-21-2017 01:26 PM by Dieter.)
Post: #2
RE: (HP65) Factorial and Gamma Function
(10-21-2017 08:32 AM)Gamo Wrote:  Just noticed that HP 65 cannot calculate decimal Factorial and HP67 app for Android also cannot do it.

What you are missing is a Gamma function. The one or other HP67 simulator app may have such a function, for instance the one from CuVee software for iPhone. Which app one are you referring to? Maybe yours has such a function as well?

BTW, the first HP with Gamma (by means of the x! key) was the HP-34C from 1979. Maybe this was even the first pocket calculator with an accurate Gamma function at all (does anyone know?). Earlier models did not feature this, and even the 41-series (introduced about the same time as the 34C) had no Gamma. Possbily to keep its factorial function compatible with the 67/97's. But a separate Gamma function (like on the 42s) would have been nice.

(10-21-2017 08:32 AM)Gamo Wrote:  Here is a handy program using Stirling's approximation for Factorial and Gamma Function.

What can you say about this approximation's accuracy? It looks good for large arguments but less so for small x, e.g. x=1 results in 0,9995. If you omit the first constant –571/2488320 the average accuracy actually seems to increase.

(10-21-2017 08:32 AM)Gamo Wrote:  This approximation is good for x<70

The approximation is good for even larger arguments, the accuracy even increases. But due to the limitation of the HP65/67's working range the max. x is near 69,9575 where the result approches 1E100, so larger x will cause an overflow error.

BTW, the ENTER after LBL E can and should be omitted and instead of [1/x] [x] you may use a simple division.

(10-21-2017 08:32 AM)Gamo Wrote:  Example: [A] 0.08 (this number always show when Initialize)

That's why I prefer a CLX or CLST at the end of such initialization routines. ;-)

(10-21-2017 08:32 AM)Gamo Wrote:  then 4.25 [B]
result approximation 35.21

Here the approximation has an absolute error of ~ –2E–5. Without the first constant it is only ~ +5E–6. ;-)

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


Messages In This Thread
(HP65) Factorial and Gamma Function - Gamo - 10-21-2017, 08:32 AM
RE: (HP65) Factorial and Gamma Function - Dieter - 10-21-2017 01:21 PM



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