Re: Mini-Challenge: My Solution & Comments Message #25 Posted by Valentin Albillo on 26 June 2006, 8:40 a.m., in response to message #1 by Valentin Albillo
Hi all,
Thanks for your interest and most specially your superb posted solutions and comments. I know I repeat myself but I continue to be amazed by your unfailing ingenuity. Now for my original solution and a few comments:
Kiyoshi Akima posted:
"Interesting challenge. Looking forward to your 71B program, V. (Though I doubt it's as short as 33 bytes :-) )"
Thanks a lot. My solution for the HP-71B is just an straightforward 2-liner, using flags, but it isn't as short as your awesome 33-byte HP-16C solution, of course. HP-71B's BASIC takes more bytes to encode operations, which is hardly a problem when even the bare-bones machine has more than 80 times as much RAM as an HP-16C (and my 160 Kb one has 800+ times as much). Still, my 2-line solution stands at a meager 120 bytes, namely
1 FIX 7 @ CFLAG ALL @ E=EXP(1) @ T=2 @ FOR I=1 TO 19 @ IF E>=T THEN SFLAG I @ E=E-T
2 T=T/2 @ NEXT I @ T=1/2^23 @ S=3.125 @ FOR I=1 TO 19 @ S=S+T*FLAG(I) @ T=T*2 @ NEXT I @ DISP S
>RUN
3.1415926
It could be made somewhat shorter by using Math ROM's base-conversion keywords, BVAL and BSTR$, but in this case the star of the show's actually the nice, unexpected result, not the program.
Karl Schneider posted:
"If this is a random coincidence, its probability of occurrence is about 1 in 5350 -- small, but not astoundingly so.
[...] As for RPL, I probably never will learn and understand it well enough to do anything very useful on my 28C, 48G, or 49G."
It *is* a random coincidence, but besides its fairly low probabilty, the most astounding thing to me is the fact that, once again, the most important transcendental constants of all are involved. It couldn't be Sqrt(5) and Ln(2) or something, it had to be Pi and e ! :-)
As for your RPL comment, I agree with the spirit of what you say, which I interpret as being:
"These machines are so complicated that it doesn't pay spending vast amounts of time to get to know them at the same level of proficiency we can achieve with RPN models, even the most advanced ones (or the 71B), then try and remember what you've so expensively learned so that next time you need it, the necessary knowledge will instantly come to your mind.
Also, where you could write a quick program on the fly, by sheer, simple keystroke programming in RPN models (or the 71B), you'll find it utterly complicated to do likewise in RPL ones, where you'll find yourself forced to do things the way the RPL system enforces upon you, and where you'll find the vast majority of operations to be performed or programmed have to do with the stack and housekeeping, instead of with the algorithmic details of your particular problem at hand."
See you all in S&SMC#17, due next week (... and it won't be *that* simple. You've been warned :-) ...)
Best regards from V.
Edited: 26 June 2006, 8:46 a.m.
|