Re: Question for Valentin; Identifying Constants Message #2 Posted by Valentin Albillo on 22 May 2012, 6:23 a.m., in response to message #1 by John Abbott (S. Africa)
Quote:
Hi Valentin, I recently typed in your HP71 program featured in your article "Boldly Going...Identifying Constants. Trying your example: CALL IDENTIFP(-2.34305547341,S$,3,3,3,12,1E-9,V) @ S$;V I don't obtain your result of -1/Sin((11/13/Pi^2)^(1/3)) 100. BTW I ran this on EMU71. Before trying to unravel this myself I thought I would ask if there was an update to this article and code, which I missed! Your response would be appreciated. Thanks John
Running on EMU71 I obtain -(241277/16168/e)^(1/2) 92
Strange. I do get the result I gave in my article, here's a verbatim copy & paste from my working Emu71 created just a minute ago:
>CAT
IDENTIF3 S BASIC 1562 07/17/04 15:01
>LIST
10 DESTROY ALL @ DIM S$[80] @ STD @ T$="identified as " @ INPUT "Value=";X
12 INPUT "#Cn,Pw,Rt,Fn,Err=","3,3,3,4,1E-9";C,P,R,F,K
14 CALL IDENTIFP(X,S$,C,P,R,F,K,V) @ IF V<95 THEN T$="might be "
16 DISP X;T$;S$;" (";STR$(V);"%)"
18 SUB IDENTIFY(X,S$) @ CALL IDENTIFP(X,S$,3,3,3,4,.000000001,0)
20 SUB IDENTIFP(X,S$,B,L,A,F,K,V) @ OPTION BASE 1 @ DIM T$[80],G$[80]
22 DATA 6,PI,EXP(1),LN(2),.577215664902,(1+SQR(5))/2,PI*LN(2)
24 DATA "Pi","e","Ln(2)","EulerGamma","Phi","(Pi*Ln(2))"
26 DATA 26,(),(),Sin(),Asin(),Cos(),Acos(),Tan(),Atan(),Exp(),Ln(),10^(),Lgt()
28 DATA 2^(),Log2(),Sinh(),Asinh(),Cosh(),Acosh(),Tanh(),Atanh()
30 DATA 1/Sin(),Asin(1/()),1/Cos(),Acos(1/()),1/Tan(),Atan(1/())
32 READ M @ DIM C(M),C$(M) @ READ C,C$,Z @ DIM F$(Z) @ READ F$ @ W1=INF
34 U=ABS(X) @ Z=MAX(1,MIN(Z,2*F+2)) @ M=MIN(M,B) @ A=MAX(1,A) @ L=MAX(1,L)
36 ON ERROR GOTO 44 @ FOR J=2 TO Z @ G$=F$(J) @ P=POS(G$,"()")
38 Y=VAL(G$[1,P]&"U"&G$[P+1]) @ IF J=2 THEN H=40 ELSE H=1
40 FOR R=1 TO A @ P=0 @ S=1 @ W=4*H @ GOSUB 46 @ FOR I=1 TO M @ FOR P=-L TO L
42 P=P+(P=0) @ S=C(I)^P @ W=H @ GOSUB 46 @ NEXT P @ NEXT I @ NEXT R
44 NEXT J @ OFF ERROR @ GOTO 52
46 CALL DEC2FRC(Y^R*S,N,D,K) @ W=(N*N+D*D)/W
48 IF W<W1 THEN V=W/W1 @ W1=W @ N1=N @ D1=D @ I1=I @ P1=P @ R1=R @ J1=J
50 IF ABS(N)+ABS(D)>1100 THEN RETURN
52 S$="("[2-(R1#1)] @ T$=STR$(N1) @ IF D1#1 THEN T$=T$&"/"&STR$(D1)
54 IF P1=0 THEN 58 ELSE T$=T$&"*/"[1+(P1>0),1+(P1>0)] @ IF T$="1*" THEN T$=""
56 T$=T$&C$(I1) @ IF ABS(P1)#1 THEN T$=T$&"^"&STR$(ABS(P1))
58 S$=S$&T$ @ Q=F$(J1)<>"()" @ IF R1#1 THEN S$=S$&")^(1/"&STR$(R1)&")"
60 IF Q THEN G$=F$(J1+2*MOD(J1,2)-1) @ Q=POS(G$,"()") @ S$=G$[1,Q]&S$&G$[Q+1]
62 S$="-"[SGN(X)+2]&S$ @ V=100-INT(100*V)
64 SUB DEC2FRC(X,N,D,W) @ V=1 @ N=1 @ D=0 @ Y=INF @ Z=ABS(X) @ F=SGN(X) @ X=Z
66 C=INT(X) @ IF FP(X) THEN X=1/FP(X) @ S=N ELSE N=(N*C+U)*F @ D=D*C+V @ END
68 T=D @ N=N*C+U @ U=S @ D=D*C+V @ V=T @ R=N/D @ IF ABS(R/Z-1)<=W THEN N=N*F @ END
70 IF R=Y OR MAX(N,D)>1.E+12 THEN N=U*F @ D=V ELSE Y=R @ GOTO 66
>CALL IDENTIFP(-2.34305547341,S$,3,3,3,12,1E-9,V) @ S$;V
-1/Sin((11/13/Pi^2)^(1/3)) 100
Compare this to your own listing or better yet, enter this listing directly into Emu71 and see if it works. If it still doesn't please feel free to contact me again and we'll definitely work it out.
Thanks for your interest and regards.
V.
Edited: 22 May 2012, 6:25 a.m.
|