The Museum of HP Calculators

HP Forum Archive 14

[ Return to Index | Top of Index ]

The Joy of Keystroke Programming
Message #1 Posted by Ben Salinas on 9 Dec 2004, 11:55 p.m.

I am quite a big fan of keystroke programming, for its on-the-fly programming advantage. I was reminded of this a few days ago. In Calculus we were going over Euler's Method and had a classwork assignment. One of the questions instructed us to either write a program or download one for our calculators to do Euler's Method. When everyone saw this, they ran back to the computer to find one. In the mean time I stayed at my table and quickly programmed Euler's method on my 32sii (I later transferred it to my 33s for the extra speed). I had finished within a few minutes. To be fair, one of my friends (who is very big into comp sci) stayed and wrote his own program as well, in TI-Basic for his 89. Needless to say, I finished much quicker than he did (of course his interface was probably nicer).

The other serious advantage with keystroke is the quick editing. One of the questions asked to use dx=.01 and find the y values for x=0,1,2,3,4,5,6,7. Now, I had written the program to output the x, y, dy, and dy/dx value for every x value. This of course would not work, as I would have to press R/S about 400 times to get from 0 to 1. I wrote a quick subroutine, and only displayed integer values. (This is where I used the 33s...each integer would take about 2 minutes on the 32sii, and only about 45 seconds on the 33s).

Just some thoughts,

Ben Salinas

12345

      
Re: The Joy of Keystroke Programming
Message #2 Posted by Nenad (Croatia) on 10 Dec 2004, 4:11 a.m.,
in response to message #1 by Ben Salinas

Hi Ben, from Split

It would be great if you would be more specific, e.g. quote the exact question from your assignment. I would like to get some more impression what kind of tasks to be solved by a programmable calculator you receive at school. Thks

12345

            
Re: The Joy of Keystroke Programming
Message #3 Posted by Ben Salinas on 10 Dec 2004, 6:29 p.m.,
in response to message #2 by Nenad (Croatia)

Hmmm...

As far as calculator use at school,there are not too many programs used, because of the abundant number of features on the graphing calculators everyone uses. On occasion there is a need for a function the calculator doesn't have (i.e: Newton's Method, Euler's Method, Reimann Sums). But, it seems that we really don't use calculator programs or functions to do most of our work.

For example, when we did integration by Partial Fractions, we could have easily wrote a program, but as we usually have to show our work anyhow, there is no point. Plus, it isnt all that tedious. This summer I took a number theory course, and programming was helpful (even though number theory doesn't have very many numbers). For example, we covered the Euclidean Algorithm, so we knew how to find common divisors, BUT it is tedious so I wrote a quick program to do Euclid's Algorithm. Later we worked with the number of numbers coprime to a number (too many uses of the word number). For this I also wrote a program, just to make things faster when testing theorems.

I turned in the Euler's Method worksheet, but the question basically told you to write a program to do Euler's Method. It then had you use the program (after we had already done a few questions by hand). It is a way of implementing technology or something silly like that.

As far as the other "offensive" comments. Personally, I am not offended by them at all. I probably was too broad in my generalizations. The other reason it took 5-10 minutes for my friend to write a program is that he is not too familiar with TI-Basic nor Euler's Method. We had done one example of it when he wrote the program.

That's all for now.

-Ben

12345

      
Re: The Joy of Keystroke Programming
Message #4 Posted by Valentin Albillo on 10 Dec 2004, 5:08 a.m.,
in response to message #1 by Ben Salinas

Hi, Ben:

Ben posted:

"I am quite a big fan of keystroke programming, for its on-the-fly programming advantage."

I mostly agree, but mainly when comparing classic "keystroke programming" RPN versus all-object-oriented-and-structured RPL. As for other programming languages or styles, read on ...

"I was reminded of this a few days ago. In Calculus we were going over Euler's Method and had a classwork assignment [...] and [I] quickly programmed Euler's method on my 32sii [ ...] I had finished within a few minutes. [...] To be fair, one of my friends (who is very big into comp sci) stayed and wrote his own program as well, in TI-Basic for his 89. Needless to say, I finished much quicker than he did (of course his interface was probably nicer).

You're not being fair. I've never used a TI-89 and TI-Basic, but either that machine/language combination is very awkward to use or your "very-big-into-comp-sci" friend is not as efficient as you want him to seem, because, after reading your post, it took me a minute (give or take a few seconds) to write this plain-vanilla, 3-line implementation of Euler's method on HP-71B BASIC:

10 INPUT "X0,Y0,H=";X0,Y0,H @ DELAY .1,0 @ FIX 5
20 Y1=Y0+H*FNF(X0,Y0) @ X1=X0+H @ DISP X1,Y1 @ X0=X1 @ Y0=Y1 @ GOTO 20
90 DEF FNF(X,Y)=Y
where you define your y'=f(x,y) as a user-defined function in line (say) 90 (here, it is y' = y), and just input your initial conditions (x0,y0) and step size (h) when prompted. The program runs non-stop, outputting each successive (xi,yi) at 0.1 seconds interval, rounded for display to 5 decimal places.

If it took you "a few minutes" to write an equivalent program for your "keystroke programmable" HP model, you see, you weren't that fast, after all.

The bottom line: against such easygoing, powerful languages as HP-71B BASIC, RPN keystroke programming is far, far, far from being the simplest, fastest way of getting things done. Not that I don't like RPN, mind you, but as they say, "to each his own".

Best regards from V.

            
Re: The Joy of Keystroke Programming
Message #5 Posted by Jeff O. on 10 Dec 2004, 8:05 a.m.,
in response to message #4 by Valentin Albillo

Quote:
....or your "very-big-into-comp-sci" friend is not as efficient as you want him to seem… ..If it took you "a few minutes" to write an equivalent program for your "keystroke programmable" HP model, you see, you weren't that fast, after all.
Valentin,
I'm sure that you intended no insult, but I feel that you were a little harsh with the above statements and the overall tone of your reply. You do realize that Ben and his friend are high-school students, don't you? From your many posts here, I infer that you have many, many years of experience programming all types of calculators, and are basically a mathematics genius (that is a sincere comment.) My guess is that you also already knew Euler’s method before you wrote your one-minute program. Ben and his friend were learning the method and at the same time trying to write programs to implement it, so it was bound to take them a little longer. Based on his input here at the MoHPC, Ben is a fine young man and is to be commended for his accomplishments. (His friend is also probably a good kid, even if he does use a TI.) We readers of the HP Museum Forum are lucky to have him posting here, so we get a fresh perspective and can have some hope for the future. I think we should encourage his apparent joy in learning, and his continued input here, rather than belittling his efforts.
                  
Re: The Joy of Keystroke Programming
Message #6 Posted by Valentin Albillo on 10 Dec 2004, 9:04 a.m.,
in response to message #5 by Jeff O.

Hi, Jeff:

Yes, yes, you're absolutely right and correct, thanks a lot for pointing it out to me, and of course, no offence to either Ben or his friend was intended, honest.

It's just that I tend to forget that not everyone here is a forty-sixer, and also that not everyone understands or likes my usually somewhat 'aggressive' sense of humor and associated remarks. I'll try to amend it a little, but can't promise. You know, it's not easy to teach an old dog like myself learn new tricks ! :-)

Thanks again to you, my apologies to Ben should he feel offended, and

Best regards from V.

                        
Re: The Joy of Keystroke Programming
Message #7 Posted by Jeff O. on 10 Dec 2004, 9:24 a.m.,
in response to message #6 by Valentin Albillo

V.
Thank you for your gracious response.
Best Regards,
Jeff

Edited: 13 Dec 2004, 7:04 a.m.

            
Re: The Joy of Keystroke Programming
Message #8 Posted by Ron Ross on 10 Dec 2004, 8:43 a.m.,
in response to message #4 by Valentin Albillo

I suspect Ben's friend isn't in the same league as you Valentin (boy is that probably an understatement). However, he could still be very good and has to overcome the Ti-89's notorious poor keyboard layout. That machine/language combination is indeed very awkward to use. It is not a QWERTY keyboard nor is it even well laid out for its vertical shape. Many Ti geeks use their PCs to hammer out any real programs.

And while the Ti-89 has CAS and is a fairly sophisticated device, its BASIC may not be on pair with the Hp71B and may not be able to stuff so many commands on a single line. And while I do have a Ti-89, I personally do not like its keyboard layout either.

And then as Jeff O. did point out, I doubt if one can readily find a high school student that can program in BASIC as efficiently as yourself. These kids are learning both the math and their mathematical tools. You already know both (or know these subjects better than most). What takes them (or even many of the rest of us) 5-10 or maybe 60 minutes, may indeed take you mere minutes (or less) to creank out. I have read a few of your articles and have no doubts to your abilities.

Please try to take into account your audience.

If I had posted about my discovery of the Pathagorian Therom and you were curt with me (or worse), I would deserve your scorn and ridicule. If a 4th grader makes the same discovery, well, do they not deserve a nice pat on the head?

                  
Re: The Joy of Keystroke Programming
Message #9 Posted by Valentin Albillo on 10 Dec 2004, 9:22 a.m.,
in response to message #8 by Ron Ross

Hi, Ron:

You're also absolutely correct. What a day, two reprimands in a row ! :-)

"Please try to take into account your audience."

I'll do, I'll do, but ... audience ... what audience ?

"If a 4th grader makes the same discovery, well, do they not deserve a nice pat on the head? "

Indeed. Any 4th graders out there in the "audience" making said discoveries, consider yourserlves patted: Pat, Pat ...

Thanks for your recommendations, sorry again, and

Best regards from V.

                        
Re: The Joy of Keystroke Programming
Message #10 Posted by Ron Ross on 10 Dec 2004, 9:55 a.m.,
in response to message #9 by Valentin Albillo

No apology needed or accepted.

Thanks for the gracious reply.

I admit, most of us here are crusty old timers, but Ben posts ofen enough that we know him and his background.

Would love to write more, but a meeting beckons.

Regards,

                        
Valentin, is your HP site up yet?
Message #11 Posted by Gene on 10 Dec 2004, 10:49 a.m.,
in response to message #9 by Valentin Albillo

I'm still looking forward to one site where I might find many of your HP41 gems, such as Mchess, checkers, reversi, othello, and more!

                              
Re: Valentin, is your HP site up yet?
Message #12 Posted by Valentin Albillo on 10 Dec 2004, 12:34 p.m.,
in response to message #11 by Gene

Hi, Gene !

Not yet, regrettably. That is, the site does exist, here, but it's still lacking most of the contents I intend to feature there eventually.

Anyway, you do have available at your site some of the very programs you mention, right ? Or do you mean a particular version of some of the programs and/or their associated documentation ?

Whatever the case, I hope to use some of the free Xmas time ahead to revamp the site with new, worthwhile contents, at the very least they will be mostly unpublished, the sole exception being my "HP-71B Modest Mater" article & program, which was published several months ago in Datafile and which I intend to make available online at my site in PDF format, as always.

Thanks for your interest and best regards from V.

                                    
Re: Valentin, is your HP site up yet?
Message #13 Posted by Gene on 10 Dec 2004, 1:53 p.m.,
in response to message #12 by Valentin Albillo

Hi again! Yes, I do have the Othello program there, but not many of the others.

Checkers would be nice. Mchess too. Were there any other "big" game programs for the 41 that never saw the light of day?

I do hope that you'll be able to put up quite a few of your other goodies soon too. :-)

Gene

            
Re: The Joy of Keystroke Programming
Message #14 Posted by HrastProgrammer on 11 Dec 2004, 1:06 a.m.,
in response to message #4 by Valentin Albillo

The bottom line: against such easygoing, powerful languages as HP-71B BASIC, RPN keystroke programming is far, far, far from being the simplest, fastest way of getting things done.

I just cannot disagree with you, Valentin :-)

Best regards.

            
Re: The Joy of Keystroke Programming
Message #15 Posted by Veli-Pekka Nousiainen on 11 Dec 2004, 8:16 a.m.,
in response to message #4 by Valentin Albillo

"The bottom line: against such easygoing, powerful languages as HP-71B BASIC, RPN keystroke programming is far, far, far from being the simplest, fastest way of getting things done."

I just can disagree with you, Valentin :-(
It depends: sometimes you just key in the function and plot the points of y against the x (or something as easy)

Best regards.
--
[VPN]

      
Re: The Joy of Keystroke Programming
Message #16 Posted by Veli-Pekka Nousiainen on 10 Dec 2004, 5:33 a.m.,
in response to message #1 by Ben Salinas

And your 32SII program & 33s program are?
Source, please
[VPN]

            
Re: The Joy of Keystroke Programming
Message #17 Posted by Ben Salinas on 10 Dec 2004, 6:38 p.m.,
in response to message #16 by Veli-Pekka Nousiainen

A01 LBL A

A02 VIEW X

A03 VIEW Y

A04 (eqn) 5xX+Y^2

A05 STO M

A06 RCL D

A07 x

A08 STO E

A09 RCL E

A10 STO+ Y

A11 RCL D

A12 STO+ X

A13 GTO A

CK=074C

Of course the checksum changes whenever you change the differential equation (which is inputed with variables x and y in A04). And yes, I realize that this is not the most efficient code (by any means). The reason I use the E variable at all is because the paper would sometimes ask for dy (so I would stick in a VIEW E)

-Ben Salinas

12345

                  
Re: The Joy of Keystroke Programming
Message #18 Posted by Ed Look on 11 Dec 2004, 1:12 a.m.,
in response to message #17 by Ben Salinas

Hey Ben! I still use keystroke programming; learned it well on a 34C. It came in handy on the job with the 32SII and now with the 33S! It makes automating some relatively tedious calculations fairly easy. It IS easier than the RPL of the 48's and the 49's, which is more like a full blown computer language (and so it is, I'm told by some here!)

And if you took any FORTRAN, the "frame" the HP keystroke programming is set in is rather FORTRAN-like, making all the more easy to at least do simple to medium complexity programs... assuming you have the memory overhead!

      
Hey Ben!
Message #19 Posted by bill platt on 10 Dec 2004, 10:58 a.m.,
in response to message #1 by Ben Salinas

Hi Ben,

It is fun to see your discovery (keystroke programming) as it is both fresh and new, as well as nostalgic. I had the same wonderful discoveries with my 11c back in 1983! (The joy of being able to program on the fly, in class, to do something that nobody else could do quite so elegantly).

Today, I am continuing with the practice, as I am doing vibration analysis on some masts and antennas--something I do only once in a while (and therfore have not programmed into a computer)--and so the keystoke (in this case, 48g and 27s style equations) are just great for speed and accuracy and being able to check etc.....although I have not made use of the units function on the 48----problably should do that! {rely on regular old algebra to do dimensional analysis})

(Something tells me that you have no problem taking the constructive criticism here--regardless of your age).

Best of luck with your studies.

regards,

Bill

      
Re: The Joy of Keystroke Programming
Message #20 Posted by Eddie Shore on 11 Dec 2004, 1:46 a.m.,
in response to message #1 by Ben Salinas

I am always please to see a young student discover the joys of math and programming; no matter what language or what calculator.

I also like your program that you posted as well. Thanks for sharing.

      
Re: The Joy of Keystroke Programming
Message #21 Posted by Fred Lusk (CA) on 11 Dec 2004, 3:48 a.m.,
in response to message #1 by Ben Salinas

Ben…

Nice story. One of life's lessons--which you have obviously figured out--is that you can learn a whole lot more about the math at hand and the problems the math is intended to solve by writing your own program(s) than by using a canned feature in a calculator or computer.

I started RPN keystroke programming in 1975 with an HP-55 (49 steps of very tight code). I was a high school senior and wrote programs for various problems in physics, though I don't remember writing any for calculus. I continued programming in college (civil engineering) with the HP-55, then an HP-34C. An HP-41CV, HP-41CX, and HP-42S became my professional tools. I still write programs, though less frequently because so many of the ones I wrote 20-25 years ago I still use. I figure that when my last RPN calculator finally dies it will be time to retire!

Fred

            
Re: The Joy of Keystroke Programming
Message #22 Posted by Eddie Shore on 11 Dec 2004, 5:27 p.m.,
in response to message #21 by Fred Lusk (CA)

Fred,

Let's hope that the RPN calcultor lives for an enternity so that generations from now will continue to know joy of RPN.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall