(41) Γ(x+1) [HP-41C]
05-02-2020, 11:04 AM
Post: #7
 Gerson W. Barbosa Senior Member Posts: 1,454 Joined: Dec 2013
RE: Γ(x+1) [HP-41C]
(05-01-2020 11:59 PM)Albert Chan Wrote:
(04-30-2020 08:35 PM)Gerson W. Barbosa Wrote:  Negative integer arguments should return a division by zero error, but because of numerical limitations this won’t occur ...

My guess HP-75C were running with default RADIANS, and HP-71B were on DEGREES
If HP-71B were on RADIANS, (-71.06)! = -1.08421623308E-99, error = 308 - 244 = 64 ULP

This explains why I was getting different results for that argument. Thanks!
I only noticed it after I posted. I thought of changing the angle mode on the HP-75C but I didn’t remember the syntax is OPTION ANGLES DEGREES, so I would do it later.

(05-01-2020 11:59 PM)Albert Chan Wrote:  To make it work on both angle units, do angle reduction with MOD

...

50 IF Q THEN F=W*PI/(F*SIN(MOD(W,2)*ACOS(-1)))

...

>DEFAULT OFF ! turn div-by-0 as error
>RUN
? -71.06
-1.08421623254E-99
>RUN
? -2
ERR L50:/Zero

That does the trick, but it doesn’t return infinite results for negative odd integer arguments. On the HP-41C I haven’t thought of anything better than multiplying F by FRAC(W)/FRAC(W) to force the division by zero error.

The HP-75C program is just a test for a possible HP-41C version. I have the math module for the HP-71B which includes GAMMA. I wish I had the HP-75C math module, but they appear to be even harder to find. I like the HP-75C because I can place it on a desk and quickly type my programs into it.
(05-01-2020 11:59 PM)Albert Chan Wrote:  Using Sinc function , Euler’s reflection formula is easy to remember: (x!)(-x)! sinc(pi*x) = 1

That’s a great mnemonic. I’ll keep it.
 « Next Oldest | Next Newest »

 Messages In This Thread (41) Γ(x+1) [HP-41C] - Gerson W. Barbosa - 04-29-2020, 09:45 PM RE: Γ(x+1) [HP-41C] - Gerson W. Barbosa - 04-30-2020, 08:35 PM RE: Γ(x+1) [HP-41C] - Albert Chan - 05-01-2020, 11:59 PM RE: Γ(x+1) [HP-41C] - Gerson W. Barbosa - 05-02-2020 11:04 AM RE: Γ(x+1) [HP-41C] - pinkman - 04-30-2020, 09:58 PM RE: Γ(x+1) [HP-41C] - Gerson W. Barbosa - 05-01-2020, 08:46 PM RE: Γ(x+1) [HP-41C] - Gerson W. Barbosa - 05-01-2020, 05:59 PM RE: Γ(x+1) [HP-41C] - Gerson W. Barbosa - 05-03-2020, 05:29 PM RE: Γ(x+1) [HP-41C] - Gerson W. Barbosa - 05-09-2020, 02:42 PM RE: Γ(x+1) [HP-41C] - Albert Chan - 09-10-2020, 10:56 PM RE: Γ(x+1) [HP-41C] - Albert Chan - 09-13-2020, 12:49 PM

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