Gamma Function Using Spouge's Method
|
09-15-2015, 06:43 PM
(This post was last modified: 09-19-2015 05:34 AM by Dieter.)
Post: #34
|
|||
|
|||
RE: Gamma Function Using Spouge's Methjod
(08-27-2015 11:21 PM)Dieter Wrote: OK, this is what I got until now for the n=4. I think this should be close to the optimum. If evaluated exactly, the maximum relative error for x = 0...70 is 1,599 E–11. So that's 1...71 for the Gamma function. Since at least negative arguments require the reflection formula, the approximation should handle values down to 0.5, i.e. where x = 1–x. So I set up another approximation which was optimized for 0.5≤x≤71. Here are the new coefficients. 10 to 13 digits are enough to keep the error within ±3.2 E–11. Code: c = 3,838 This way arguments below 0.5 can be handled by the reflection formula. And, for the record, here are the coefficients of a n=5 approximation for the same domain (0,5≤x≤71). Evaluated exactly, the relative error is within ±4,2 E–13. At x=0,5 the error is close to zero. Within the mentioned error bounds the approximation may be used down to x=0,057. Code: c = 5,081 These are 20 digits, but a few less should do either. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)