Post Reply 
(41) Γ(x+1) [HP-41C]
05-01-2020, 11:59 PM
Post: #6
RE: Γ(x+1) [HP-41C]
(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

To make it work on both angle units, do angle reduction with MOD

10 INPUT X
15 P=1 @ Q=0
20 IF X<0 THEN Q=1 @ W=X @ X=-X
25 IF X<4 THEN X=X+4 @ P=X*(X-1)*(X-2)*(X-3)
30 Y=2*X
35 C=41/30-X/38+X*X/92
40 Z=X+1/(6-1/(Y+6/(7-6/(Y+C))))
45 F=SQR(2*Z*PI)*(X/EXP(1))^X/P
50 IF Q THEN F=W*PI/(F*SIN(MOD(W,2)*ACOS(-1)))
55 DISP F

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

Using Sinc function , Euler’s reflection formula is easy to remember: (x!)(-x)! sinc(pi*x) = 1
Find all posts by this user
Quote this message in a reply
Post Reply 


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: 2 Guest(s)