OK, here’s another in the category of “Why even bother?” Eddie’s post on “L, G, and some trig functions” inspired me to implement GAMMA on the 17bII+.

Victor T. Toth’s page on “Calculators and the Gamma Function” is an excellent resource, and I’ve used his listing of the Lanczos approximation.

ONLY valid for POSITIVE values of z. The SIN identity for negative values of z COULD be used IF the 17bII+ had a built-in SIN function. Coding the extra steps to calculate SIN results in the now familiar overflow condition of GAMMA being returned as being 0.

Pretty simple, pretty accurate for positive z, pretty useless ;-)

Bob Wang

Eddie Shore’s post on “L, G, and some trig functions”Calculators and the Gamma Function

GAMMA:

(75122.6331530

+80916.6278952×Z

+36308.2951477×Z^2

+8687.24529705×Z^3

+1168.92649479×Z^4

+83.8676043424×Z^5

+2.50662827511×Z^6)

÷Z÷(Z+1)÷(Z+2)÷(Z+3)÷(Z+4)÷(Z+5)÷(Z+6)

×(Z+5.5)^(Z+.5)

×EXP(-(Z+5.5))

-GAMMA