I have a stack-oriented mind.

Tonight, I was using a Windows computer at a friend’s place and I wanted to perform a bit of math on relatively large numbers. Nothing I’d need a bignum library for, but large enough that it would be a huge hassle for me to do it mentally. My HP-48GX being in an inconvenient location and dc being on a disk drive far away, I fired up the standard Microsoft scientific calculator.

I was nearly lost. The single-line display constrained me to looking at one number at a time, and the lack of an enter button prevented me from using the calculator’s memory as a convenient storage location. The closest thing to my beloved enter was something labelled `=’, which would only produce a remotely useful result at the end of a series of computations. As a final insult, the program demanded I enter the operators in between the numbers, as opposed to after them as God and Charles Moore intended.

I floundered for a bit before steeling my resolve, closing the program, and returning to a familiar friend: Excalibur, a freeware RPN calculator for 32-bit Windows versions. The brief download was worth the feeling: I could use a calculator correctly again! It was like being untied and de-blindfolded.

This whole process amazed me. I used algebraic calculators for years before I discovered the sublime joys of stacks and their attendant, Reverse Polish Notation (RPN). I learned algebra in high school, and I still work things out on paper in a more-or-less algebraic way. In fact, I got my first (and, right now, only) RPN calculator under a year ago.

But when my mind accepts a good way of doing something, it has a tendancy to jettison the excess baggage. In this case, that baggage was any comfort I once had with algebraic calculators. In return, I’ve gained a huge facility with stacks, to the point of being able to mentally manage a four-level stack without resorting to notes of any kind (my HP only displays four levels, hence my facility with that depth). I now think of using calculators to solve a problem in terms of how I would manipulate numbers on a stack, and I think the HP’s RPL language (a nice little Forth descendant) is much more natural than the BASIC knockoff TI uses in its calculators. After all, the stack allows a good way to hide variables, something TI’s BASIC cannot provide.

I haven’t lost the ability to use algebraic notation, as I’ve said. I can still hack C and Python and use a TI and do all manner of things with algebraic notation as long as I can always see the full equation. What I have lost is the ability to be comfortable with an algebraic calculator that only displays numbers. I can now keep a stack in my head better than I can hold a traditional equation, and I find that fascinating.

My hubby loves his RPN calculator. With it I can’t even add 2 plus 2!

Yeah - my father gave me his old HP-41C a long time ago and I used it all through high school and college. It is so much easier to figure out complex equations with an RPN calculator and the programability of this one was a very nice bonus.

I still have it but I rarely use it now - I don’t need to do any math that complicated anymore. I did find an emulator for it that runs on my PDA so I still have it around if I need it - at least in spirit. :wink:

I used one so nobody would borrow my calculator.

RPN? Never heard of it. Does it use postfix instead of infix?

ie (2 (4 5 +) x) = 18 (postfix)
or (2 x (4 + 5) = 18 (infix)

It has to do with how you enter values into the calculator. Here is a page with information about this from the Museum of HP Calculators:

http://www.hpmuseum.org/rpn.htm

Oh, which is what I thought. I put the parentheses there to aid others, when the calculator sees an operand, it takes the last two numbers and does the operation on them.

Damn it. I used my HP-GX like a madman in school but I bet I couldn’t even get the Snake game up and running now.

Well, RPN usually drops the parentheses (we figure Lisp uses enough parens for everyone).

For example, your example would look like this if we explicitly wrote down every key we’d press to enter it into an interpreter, like the HP-48GX:


2 [enter] 4 [enter] 5 + *

But we don’t write down all of those [enter]s in the Real World. It would be annoying.

And, as to your next post, we usually interpret operators (or words, if you speak Forth) as `consuming’ operands from the stack and returning values to the stack (or not, in the case of drop, which drops the top item off of the stack). So + consumes two numbers and returns one number, and drop consumes one item and returns nothing. ([enter] is not a fully-fledged word. It is a convention used to seperate numbers in an interactive environment. In HP calcs, [enter] doubles as dup, which duplicates the item on the top of the stack.)

So, to complete the visualization, your example pushes three numbers onto the stack (2,4,5) and consumes the bottom two (4,5) with +, leaving (2,9). Then * comes along to consume those, and leaves one number on the stack (18). Hence, 2*(4+5) = 2 4 5 + * = 18.

(Did I lose you, tanookie? I hope not.)

Upon reading, I realized that I use top' of stack and bottom’ of stack as synonyms. Which could be confusing.

I suppose I should just standardize on top,' so I can use the analogy to a stack of plates more easily. So replace the one instance of bottom’ in my last paragraph with `top’ and read a more consistent post. :slight_smile:

(And you can learn obsolete assembly languages later, once you’ve forgotten about this thread. ;))