mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

I've been reminiscing a lot about calculators lately. I started learning math just when electronic scientific calculators were replacing slide rules as tools for engineers.

But scientific calculators are themselves almost extinct outside of the classroom, because computers, smartphones and tablets running powerful CAS or numerical software can do all the kinds of computing you really need... unless you're not allowed to use them because of classroom or exam restrictions.

So the market has contracted to education, and the high-end calculators sold today, though they're extremely powerful, are very much catering to students rather than to engineers or scientists. There's a lot of power siloed into user-friendly apps, but less ability to link those together into powerful custom-built systems of your own design.

And inevitably, because I'm getting old, I have a lot of nostalgia for old ones... particularly for HP's RPL line, starting in the late 1980s with the 28C (which was woefully underpowered, but the potential was there) and continuing through the very capable 28S and 48/49/50 series.

The ones I actually had were the 28S and the 48SX--the latter got stolen after just a few years; it was too damned expensive to leave lying around. I still have the 28S somewhere though the batteries for it can be hard to find. But I've been getting back into messing with them through emulation. Here's Calculator Culture's review of the 48SX that goes through its innovations, strengths and weaknesses.

youtube.com/watch?v=yujtxo5efb

HP's scientific calculators were quirky in that most of them until quite recently solely or primarily used postfix or Reverse Polish Notation (RPN), a stack-based system in which every operator followed its operands: to add 2 + 3, instead of

2 + 3 =,

you'd press

2 [ENTER] 3 +.

These calculators had a stack, that is, a list of numbers represented as a vertical tower that they would generally enter and exit from the "bottom" (in HP's terminology, at least). In the addition above, the ENTER key would signal that you were finished typing a number and put the 2 on the stack. The + would implicitly do an ENTER if necessary, then take the bottom two items off the stack and add them.

For more complex calculations, there was no messing around with order of operations or nested parentheses--the stack was everything. So, say, (4+5) * 3 - 2 could be entered as

4 5 + 3 * 2 -

(where it's understood you type ENTER after every number not followed by an operator.)

The joke was that an advantage to using an HP was that nobody ever asked to borrow your calculator more than once. But for complex calculations off the cuff, people who used them soon learned to prefer RPN to algebraic entry, and I still like it.

Now, the RPL line overhauled and expanded this system in ways that annoyed some RPN calculator purists, but it was where I came in, so none of this bothered me much.

HP's older calculators all had a four-level stack, with levels named X, Y, Z and T, and they often only showed the bottom, X level on the display. With these new models, the stack was "infinite" up to the capacity of the calculator's RAM, and they'd display the bottom few levels.

And instead of just storing numbers, a single stack level could store... *anything*: a matrix, a vector, a complex number, a string, a bitmap image, even a function or an algebraic expression. Or a list of other objects.

Because the programming system in these models had been expanded into a functional language with list processing, that could script anything the calculator could do, called RPL (which unofficially stood for "Reverse Polish Lisp"). RPL was my favorite programming language for a while, back in the day, though I'm rusty. For a handheld device in the late 1980s it was mind-blowingly powerful.

These calculators were also the first to have some CAS and graphing capabilities. They could do some symbolic algebra and symbolic calculus on algebraic expressions (on top of the numerical evaluation and integration of functions that HP's scientifics could always do).

Probably the most controversial thing to older-school HP fans was that the algebraic expressions that the symbolic math functions could manipulate were *only* expressed in algebraic notation, not in RPN. Beginning with the 48, there was even a "WYSIWYG" equation editor. That was anathema to some, and I suppose in some ways it was the crack of doom for RPN as they'd known it.

Matt McIrvin

...Something I'd been a little curious about was why so many people preferred the classic, simpler version of HP's RPN that there was continued demand for it *after* RPL appeared.

Playing with it in emulation, I think I get it: while I don't personally prefer it, it's just different enough for the difference to throw off muscle memory, which I think is something that gets people who do a lot of calculation attached to a particular model. And it's maybe simpler to explain, though every model seemed to handle things like complex numbers and matrices differently.

One difference is in a subtlety of how number entry and the ENTER key work: in classic RPN, you're typing directly into the X register (the lowest stack level), and ENTER always pushes the stack and copies it to Y.

In RPL, you're really typing into a separate input buffer, and ENTER will push the stack and move that to the lowest level, giving you an opportunity to cancel errors before altering the stack (but operators also do an implicit ENTER if you're entering a number). ENTER only copies to the second stack level if you aren't entering data. It's a very subtle difference but can throw you off.

Another quirk of classic RPN with its four-level stack was that the fourth, top level, T, was "sticky"-- dropping the stack would copy anything in it to the lower levels, so it was like you had infinite copies of whatever was in there. People could take advantage of that, and that behavior went away with the "infinite" stack in RPL.

...also, since classic RPN evolved from a system that only supported floating point numbers, all stack levels contained the number 0 by default. RPL, with its sophisticated type system, also has a concept of null, and the stack starts out empty, with math operators unable to act on it. That's a big difference.

So I can see a lot of engineers who wanted to bang on numbers and did not want to think about computer science concepts preferring the classic system.

(So if you go back and read closely, you'll see that in my post describing RPN, I was technically describing the RPL version of RPN because that was what I was familiar with. If you learned RPN from the computer language Forth or Postscript, those are actually closer to the RPL version of RPN than to the classic HP version.

Though there's also another terminology difference in that in those languages you usually imagine the business end of the stack as being the top, rather than the bottom, and items "pop" off the stack instead of "dropping" off. I think HP had multi-line displays on their desktop calculators from early on, so this was more than just conceptual there.)

@mattmcirvin
I had a HP15c for many years. Even now I use an RPN calculator on my phone ("realcalc" on Android).

RPN is, to me, the easiest way to think about numerical calculations. Using parentheses for grouping feel clumsy by comparison.

@jannem Some of my grad school classmates had the 15c-- it seems to be a particularly beloved model. The financial counterpart, the 12c, became such an industry standard that it is still sold today, in a version with modern internals but an essentially identical case design to the original.

@mattmcirvin
It's definitely easier to work out calculations on the fly with RPN and put off deciding to do with the parts to later. Like first work out the mass, then work out the velocity, square that, multiply by the mass that's still on the stack, now divide by 2.
The stack seems small, but is sufficient for all arithmetic and two arg functions.

@Sdowney Even with an unlimited stack, you soon prefer to organize calculations so that it doesn't get too deep, to reduce the cognitive load. It helps to be able to see more of it though.

A pattern I liked to use a lot with the tall RPL-style stack was that if there were a bunch of numbers or terms I wanted to add together, I'd put them all on the stack, review them to make sure they made sense and only add them up at the end. A deep stack with a multi-line display helps with that. It's not too different from the adding-machine logic in accountants' desk calculators, where the printer prints out all the terms while the machine internally maintains a running total/subtotal. Useful when you're dealing with money--I just hauled out the 48 emulator when helping my daughter fill out college financial-aid documentation. Though I suppose a spreadsheet might have been more appropriate.

@Sdowney The *comments* on this old video about the HP-12C are fascinating:

youtube.com/watch?v=Ot6rgGJv46

because when he talks about how it works, he doesn't even use the word "stack", he just mentions the X and Y registers. And then he talks about the numbered storage registers, but he doesn't mention the stack going higher than Y.

And that results in a bunch of people in the comments saying "wow, I could never understand RPN but you just explained it in a way that made me understand."

Maybe keeping it finite and small reduces the cognitive load.

@mattmcirvin
I inherited my Dad's 12C a few months ago. Mine vanished sometime after I got out of WallSt a few decades ago.
I have my 28s at my desk, but need to replace the batteries again.

An elegant weapon for a more civilized age.

But I mostly use the a41cv android app.