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.

A thing I'd forgotten how to do until the other day was how to define a new function that could not just be evaluated (like executing a program), but actually be used in algebraic expressions that you could simplify, graph, differentiate and so forth. The answer was the DEFINE key. Thinking about it is a little illuminating about how it did CAS stuff.

If I wanted to define my old friend the Gudermannian arctan(sinh(𝑥)), I could just write a little RPL program that went

« SINH ATAN »

and store that in a variable called GD, and it'd make a button that would find the Gudermannian of the bottom thing on the stack. Great! Simple! But if I put GD(X) in an algebraic expression, it won't work. The CAS and graphing stuff isn't up to chewing on arbitrary RPL programs.

But what will work? If I instead enter the algebraic equation

'GD(X) = ATAN(SINH(X))'

and hit the DEFINE key, now what happens seems to be exactly the same, only now I can use GD(X) in algebraic expressions just like it was a built-in function. I can differentiate or integrate it, I can graph it, great!

If I look at the contents of the GD variable, what's in there? It's still RPL, but it looks like this:

« → X 'ATAN(SINH(X))' »

Ha, it looks kind of like a lambda expression with a bound variable, but in RPL! I guess I know why they call it Reverse Polish Lisp.

Anyway, the pattern from the perspective of the user interface was clearly that anything you entered algebraically could be manipulated by the symbolic math system, whereas anything that was pure RPL couldn't be.

So this "lambda expression" format was a kind of wrapper to make an RPL program that just represented an algebraic expression. (I *think* that the algebraics were really represented internally in an RPL-esque format, but it was clearly a specially restricted subset.)

There was another level called "System RPL" that was compiled and removed a lot of type checking for speed, and in which apparently the internal utilities were written, but I never got into that. User RPL was enough.

Anyway, how am I even messing with this stuff, given that I don't currently have batteries for my 28? Well, there are free emulators for these things.

For a while, I've had an Android 48G/48S emulator on my phone called Droid48, and I actually use it for day-to-day calculation sometimes. Most of the advanced capabilities of these calculators can be done better by other means these days--Wolfram Alpha has a phone app that is, like, three bucks, and even the Google search bar is a fairly sophisticated calculator. But sometimes you want to bang out stuff in RPN.

Lately I discovered that a much fancier, popular Windows emulator called Emu48 had been ported to Android--this one actually supports a whole bunch of HP calculators, including the 50g, which was the latest and greatest in the line, from 2006.

The 50g was a big enough beast that its keyboard can be a little difficult to manipulate on my little phone screen, but it's impressive.

It added something that must have seemed even more like the crack of doom for reverse Polish notation: a purely algebraic entry mode much like TI's calculators... which is the default! But you can switch it to RPN entry easily.

But that was the last RPL calculator. Later ones do have a simpler RPN mode, but their programming environments are different.

youtube.com/watch?v=eBK60gQjeI

Matt McIrvin

Playing with the HP 50G in emulation for a little while... in some ways it does seem like the ultimate refinement of the RPL line; in other ways, there are things I don't like.

The keyboard was rearranged completely to give it a more TI-84-like feel, and it makes it hard for me to find stuff. But on the other hand, I give the keyboard layout huge credit *just* for including an unshifted X key, which is a great convenience for entering algebraic formulae.

It doesn't have an i key, but they did make it so that (unlike the 48 models) i requires only a single shift rather than shift + alpha. That is good too.

(Some of their other later RPN calculators actually included a built-in i key, which was great for electrical engineers.)