HP Forums
(25) (25C) Accurate Gamma Function and Factorials - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (25) (25C) Accurate Gamma Function and Factorials (/thread-15558.html)



(25) (25C) Accurate Gamma Function and Factorials - Valentin Albillo - 09-08-2020 05:35 PM

 
Extracts from HP Program VA252 - HP-25 Gamma Function and Factorials
    Abstract
     
      GAMMA is a program written in 1975 for the HP-25 programmable calculator and compatible models, to accurately evaluate the Gamma function in the interval [1, 2], as well as approximate factorials for real-valued x. Three worked examples are included.

      Keywords: Gamma function, factorial, Stirling’s formula, programmable calculator, RPN, HP-25, HP-25C

    Introduction
     
      GAMMA is a short (49 steps) RPN program that I wrote in 1975 for the HP-25/25C programmable calculators (will also run as-is or with very minimal modifications in most any RPN models) which can accurately compute the value of the Gamma function for x in the interval [1, 2]. It uses [...]

      This gives results correct to 9 places over the whole interval, and even to ~10 places for many arguments. To compute Gamma(x) for other intervals, repeated multiplication or division may be used. See Example 2.

      Also, as a side benefit the program can be easily modified to quickly compute approximate factorials x! for real x (not just integer), 1 <= x <= 69.957. The accuracy begins at ~ 4 places for x = 1 but steadily improves to ~ 9 places as x grows bigger. See Example 3. [...]

Link to PDF: HP Program VA252 - HP-25 Gamma Function and Factorials

V.