Question for Valentin; Identifying Constants John Abbott (S. Africa) Member Posts: 96 Threads: 20 Joined: Sep 2011 05-22-2012, 06:10 AM Hi Valentin, I recently typed in your HP71 program featured in yourarticle "Boldly Going...Identifying Constants. Trying your example:CALL IDENTIFP(-2.34305547341,S\$,3,3,3,12,1E-9,V) @ S\$;VI 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.ThanksJohnRunning on EMU71 I obtain-(241277/16168/e)^(1/2) 92 Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-22-2012, 06:23 AM Quote: Hi Valentin, I recently typed in your HP71 program featured in yourarticle "Boldly Going...Identifying Constants. Trying your example:CALL IDENTIFP(-2.34305547341,S\$,3,3,3,12,1E-9,V) @ S\$;VI 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.ThanksJohnRunning 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 W1100 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. John Abbott (S. Africa) Member Posts: 96 Threads: 20 Joined: Sep 2011 05-22-2012, 06:41 AM Hi Valentin, thanks for your really quick response - Appreciated :)Running this now I now get: -10553/12243*E 46I don't know if I am just doing something wrong, as I am new to the HP71, so please excuse my ignorance if it is something obvious to an experienced user!I copied and pasted your listing into EMU71.Thanks again for your help.Kind RegardsJohn Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-22-2012, 07:04 AM Quote: Hi Valentin, thanks for your really quick response - Appreciated :)Running this now I now get: -10553/12243*E 46I don't know if I am just doing something wrong, as I am new to the HP71, so please excuse my ignorance if it is something obvious to an experienced user!I copied and pasted your listing into EMU71.Thanks again for your help.Kind RegardsJohn I suspect that copy & paste isn't working for you, for whatever reason. You can ascertain that by listing the program on the Emu71 emulated 80x25 display and comparing it visually with the listing I posted. - if there are no differences then we'll explore further but - if there are differences this means paste doesn't work realiably on your Emu71. In that case do the following (taken from J.F.'s documentation): 1) copy your source file [the listing I posted, no blank lines] to "emu_in.dat", 2) in Emu71, write a small program to enter lines from the DOSLINK device and write to a TEXT file: ``` 10 DESTROY ALL @ DELAY 0,0 @ DIM A\$[100] 20 CREATE TEXT "file" 30 ASSIGN #1 TO "file" 40 ENTER :DOSLINK;A\$ 50 DISP A\$ ! just to follow the process 60 PRINT #1;A\$ 70 GOTO 40 ``` Run it and when the program stops on ENTER statement (no more lines to ENTER), close the file with ASSIGN#1 to * Then TRANSFORM it into BASIC and there you are. See if that works for you. Regards from V. ``` ``` Jeroen Van Nieuwenhove Member Posts: 88 Threads: 5 Joined: Mar 2011 05-22-2012, 02:38 PM Hi Valentin, I carefully copied and pasted your program in Emu71 and I get the same result as John, i.e. -10553/12243*e 46. CAT gives me the same program length (1562 bytes) as yours. I also verified several lines afterwards and they look exactly the same as in your program. I have the Math ROM enabled in my emulation. Kind regards, Jeroen Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-22-2012, 03:49 PM Hi, Jeroen: Quote: Hi Valentin, I carefully copied and pasted your program in Emu71 and I get the same result as John, i.e. -10553/12243*e 46. CAT gives me the same program length (1562 bytes) as yours. I also verified several lines afterwards and they look exactly the same as in your program. I have the Math ROM enabled in my emulation. Weird. Please post here the exact verbatim list of the code as directly grabbed from your Emu71 display (i.e. the code you're running which produces the weird result), for me to inspect and try in my copy of Emu71. I'll use a comparison program to avoid human error so this way I'll be able to see if there's some difference, any difference. Further action will depend on the result of the above. For now I suspect of some problem with the copy-paste procedure but we'll see when you do the above, if you're so kind. Thanks for your interest and Regards from V. ``` ``` J-F Garnier Senior Member Posts: 412 Threads: 40 Joined: Mar 2006 05-22-2012, 04:37 PM ```>degrees >CALL IDENTIFP(-2.34305547341,S\$,3,3,3,12,1E-9,V) @ S\$;V -10553/12243*e 46 >radians >CALL IDENTIFP(-2.34305547341,S\$,3,3,3,12,1E-9,V) @ S\$;V -1/Sin((11/13/Pi^2)^(1/3)) 100 ``` J-F Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-22-2012, 05:36 PM Quote: ```>degrees >CALL IDENTIFP(-2.34305547341,S\$,3,3,3,12,1E-9,V) @ S\$;V -10553/12243*e 46 >radians >CALL IDENTIFP(-2.34305547341,S\$,3,3,3,12,1E-9,V) @ S\$;V -1/Sin((11/13/Pi^2)^(1/3)) 100 ``` J-F ``` ``` LOL ! ... XD That's it, of course, but you know what, J.F. ? I was thinking that it might be that old problem of some versions of Emu71 missing characters when pasting text (a program listing or commands) to them. Matter of fact, paste still doesn't work 100% ok, at least not in my version. It has the following quirks: - it reverses the capitalization of the pasted text, i.e., you paste "10 PRINT 'Hello'" and it gets pasted as "10 print 'hELLO'" - some frequent text combinations are interpreted as if they were 'escape' sequences missing characters altogether, i.e.: pasting "10 FOR I=1 TO 10 @ A=2^I+5*B(I) @ NEXT I" results in "10 for i=1 to 10 @ a=2+5*b(i) @ next i" and the power of 2 (2^I) is silently changed to a simple "2", which usually results in the wrong results afterwards. ``` ``` That said, any hope of an Android version of Emu71 specifically tailored or at least fine-tuned to the underlying Arm processor ? That failing, any newer version of Emu71, ideally faster that the one I have ? I'm using Emu71 to successfully solve Project Euler problems, a sizable number of them so far, in dire competition against C++, Java, Haskell, Python, Mathematica, Assembler, etc. running on powerful hardware so every little bit of speed does help ! ... :D Thank you very much and best regards from V. ``` ``` Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 05-22-2012, 05:40 PM Quote: 2) in Emu71, write a small program to enter lines from the DOSLINK device and write to a TEXT file In Windows Vista I don't need such program. I just set lowercase in Emu71 (by typing LC) and select EN (English) in the language bar, instead of my default PT (Portuguese). Copy & Paste works nicely then. By the way, in RADIANS mode I get`-1/Sin((11/13/Pi^2)^(1/3)) 100` But in DEGREES mode I get`-10553/12243*e 46` Best regards, Gerson. Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 05-22-2012, 05:58 PM Quote: - it reverses the capitalization of the pasted text, i.e., you paste "10 PRINT 'Hello'" and it gets pasted as "10 print 'hELLO'" Try the lowercase command (LC) on Emu71, as I did in my post below. I got home minutes ago and only overlooked the posts, otherwise I would not have mentioned the DEGREES/RADIANS issue. Best regards, Gerson. John Abbott (S. Africa) Member Posts: 96 Threads: 20 Joined: Sep 2011 05-23-2012, 02:20 AM Thanks to Valentin,Gerson and JF. I can't believe I did not try switching to RAD. I really appreciate the help from forum members. It works perfectly now :) Thanks again.BTW, when I run the Doslink code to read in a text file, my EMU71 freezes on the last line.I have to close EMU71. Any thoughts?Thanks once againRegardsJohn Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-23-2012, 04:24 AM Quote: Thanks to Valentin,Gerson and JF. I can't believe I did not try switching to RAD. I really appreciate the help from forum members. It works perfectly now :) Thanks again. You're welcome, and thanks again for your interest. Quote: BTW, when I run the Doslink code to read in a text file, my EMU71 freezes on the last line.I have to close EMU71. Any thoughts? Yes, no problem at all, I think it is the intended, normal behavior. Just press [End line] and there you are, no need to close Emu71 or anything. Regards from V. ``` ``` J-F Garnier Senior Member Posts: 412 Threads: 40 Joined: Mar 2006 05-23-2012, 02:33 PM The ^A, ^E, ^I, ^O and ^U sequences are not correctly handled by the paste operation, for some unknown reason. I was not able to fix it. Of course, manually keying-in ^I and so on, is no problem. When pasting a text file created by an external editor, a possible workaround is to insert a space after the ^ character. Regarding, speed, the lastest version (2.41) provides a modest speed improvement of 5-10%. Thanks for your interest in Emu71/DOS! J-F Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 05-23-2012, 04:56 PM No problem here, unless I am missing something. The lines 50 and 60 below have been simply copied from Notepad and pasted into the Emu71 window: ``` Emu71: HP-71B & HP-IL system emulator J-F GARNIER 1996, 2006 Registered to Gerson Barbosa > >LIST 50,60 50 X=2^3 60 A=A^A @ A=A^E @ A=A^I @ A=A^O @ A=A^U ``` Gerson. Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-23-2012, 05:20 PM Hi, Gerson: This is what I get when I try your example (which I copied to Notepad from your post, then re-selected it in Notepad and copied to the Emu71 window): ``` Emu71: HP-71B & HP-IL system emulator J-F GARNIER 1996, 2006 >50 x=2^3 >60 a=a @ a=a @ a=a @ a=a @ a=a >LIST 50 X=2^3 60 A=A @ A=A @ A=A @ A=A @ A=A ``` Regards from V. ``` ``` Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 05-23-2012, 07:45 PM Hello Valentin, I've repeated my procedure on Windows XP and obtained your exact result: ```>50 X=2^3 >60 A=A @ A=A @ A=A @ A=A @ A=A ``` Back to Windows Vista, language bar set to PT, Português (Brasil), I got ```>STOP >LC >50 X=2"3 ERR:Excess Chars >50 X=260 A=A"A @ A=A"E @ A=A"I @ A=A"O @ A=A"U ERR:Excess Chars ``` Changing the language bar to EN, English (United States), and copying and pasting my original example again gives ```>50 X=2^3 >60 A=A^A @ A=A^E @ A=A^I @ A=A^O @ A=A^U > ``` I haven't tested this on Windows 7 yet. Best regards, Gerson. Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 05-24-2012, 03:58 PM Hi, Gerson: Seems you've nailed it. Perhaps J.F. can do something about it now that the problem has been shown to be related to the Windows locale. Thanks and best regards from V. ``` ``` « Next Oldest | Next Newest »

 Possibly Related Threads... Thread Author Replies Views Last Post HP Prime Fundamental Constants Timothy Roche 7 2,670 12-04-2013, 04:49 PM Last Post: Walter B [HP Prime] Constants Library Values Timothy Roche 24 5,704 11-02-2013, 04:17 PM Last Post: Les Koller Qestion to Valentin Albillo Mike (Stgt) 1 870 07-09-2013, 08:12 PM Last Post: Valentin Albillo WP-34S assembler & constants Marcel Samek 8 1,940 06-27-2013, 12:27 PM Last Post: Marcel Samek Infinity constants on WP-34s Marcel Samek 4 1,357 06-20-2013, 12:15 AM Last Post: Paul Dale Need help identifying a few components. Bruce Larrabee 2 972 01-31-2012, 07:39 PM Last Post: Paul Berger (Canada) WP34S: Valentin Albillo's Polynomial Root Finder Miguel Toro 28 5,236 11-23-2011, 07:39 PM Last Post: Miguel Toro Public apology to Valentin Albillo fhub 16 3,083 11-14-2011, 09:53 AM Last Post: Valentin Albillo Identifying equations on HP 35s Richard S 4 1,193 08-10-2010, 08:01 PM Last Post: Richard S How is Valentin Albillo kc 6 1,453 12-21-2008, 06:36 PM Last Post: Bruno Férard

Forum Jump: