# Engineering - my girlfriend had an HP calculator

When I grew up in the seventies, we knew that computers exist, but they were not part of our everyday life. Computers where mainframes, entire buildings full of electronics useful only for accounting, statistics and engineering. The most present image for a computer for me was probably HAL, the bord computer in the Stanley Kubrick film 2001. The computer was evil, of course (HAL is IBM - 1), supervising all pilots through through its red eye.

But we had calculators in the gymnasium. There weren't many models at the time. The teacher proposed us to buy the TI-55 which allowed to do whatever we needed for math and physics (logarithms, trigonometry and statistics) and also had memory registers that allowed to write a program, theoretically up to 64 steps. I used that in geography to write a small program that calculates the weekday using the gregorian calendar. The calculator run on expensive batteries (LR-44) and the red LED used a lot of energy.

My girlfriend at that time was in another class and had an HP calculator. I think it was HP 34C. She is a daughter of a railway engineer and was quite proficient in science and later graduated in biology. It had less keys which were more robust, but the calculator provided the same set of functions with two shift keys (f and g). Also, it had more programming steps (up to 210).

But the real difference was the RPN mode. Imagine you want to convert 451 Fahrenheit to Celsius. The formula is C = (F-32)*5/9

The TI-55 used the algebraic mode as written in school. You type

`( 451 - 32 ) × 5 ÷ 9 =`

To type this correctly, the calculator must provide parenthesises and an equal sign to end the calculation. Cheap calculators do not have parenthesises and you are limited in calculation. With the TI-55, you can master complex calculation as long as you get the parenthesises right. However, you will know the result only at the end, as there is no intermediate result.

The HP34c uses the RPN mode which seems strange for every first time user. There are no paranthesises and there is no equal sign. Instead of that you type

`451 ENTER 32 - 5 × 9 ÷`

What happens here? The calculator maintains a stack for four registers called X, Y, Z and T. When you type numbers, they are pushed on the stack. When you type an operator, the values are pulled from the stack, the operator calculates and pushes the result on the stack.

key | X | Y | Z | T |

4 | 4 | 0 | 0 | 0 |

5 | 45 | 0 | 0 | 0 |

1 | 451 | 0 | 0 | 0 |

ENTER | 451 | 451 | 0 | 0 |

3 | 3 | 451 | 0 | 0 |

2 | 32 | 451 | 0 | 0 |

- | 419 | 0 | 0 | 0 |

5 | 5 | 419 | 0 | 0 |

× | 295 | 0 | 0 | 0 |

9 | 9 | 295 | 0 | 0 |

÷ | 232.77778 | 0 | 0 | 0 |

The ENTER operator is needed to separate two numbers.

The RPN mode is much more like the computer works. Behind the algebraic mode of TI-55 there is a very complex parsing of the algebraic expression to construct a tree that allows the calculator to make the calculation. The RPN mode is much more simple. There is quite no syntax. You either push values on the stack or you use an operator that works on the stack.

While it is understandable HP built the calculator like this, it is less obvious why humans should use this calculator. It's like putting the cart before the horse. I must admit I did not understand it at that time.

The reason is all about control. When you are an engineer and you have a complicated formula, you prefer to enter the formula how the calculation is developing and having all the time the control of the values. When you use the HP 34C, you are always in control. For every operation, you get an immediate result. You can even inspect the stack during the calculation to verify everything is in order.

With this advantage, you calculate faster and you are more confident about the result. I finally bought an HP 15C when I was at the university.

I do not remember the weekday algorithm for TI-55, but we could implement it in PostScript. I will do that in the chapter Sidenote - unit test, when we have completed the RPN calculator.