Gamma Function Using Spouge's Method
|
08-12-2015, 09:11 PM
(This post was last modified: 08-12-2015 10:59 PM by Dieter.)
Post: #6
|
|||
|
|||
RE: Gamma Function Using Spouge's Methjod
(08-12-2015 05:39 PM)Dieter Wrote: Addendum: This also means that a value as high as a=12,5 does not make much sense here. Try Namir's program with a=7 (replace 12.5 with 7 and 1.012 with 1.006). My tests returned results at least as accurate as with a=12,5 (mostly even better) while the program runs about twice as fast. FTR, here is my implementation for the '41, based on a "hard-wired" a=7. Like the factorial function on various other HPs, it actually calculates Γ(x+1). Code: 01 LBL "GAM+1" Since it doesn't seem to get much better than 8 valid digits in the final result, a=7 is sufficient here. Evaluated exactly, the largest relative error is approx. 2,3 E–9. Actually the error may be slightly higher. But it should be less than in the original a=12,5 version. Some examples: Code: 3 XEQ"GAM+1" => 5,999999994 The current version throws an OUT OF RANGE error for x > 54,9. Maybe this can be improved somehow. Edit: the following modification may be a solution. However, the resulting accuracy is slightly less than in the first version. Code: ... This way x=69,9575744 returns 9,999997034 E+99 (exact: ...7560). Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)