[TUHS] The most surprising Unix programs

Juergen Nickelsen ni at w21.org
Mon Sep 14 01:44:57 AEST 2020


Grant Taylor via TUHS <tuhs at minnie.tuhs.org> writes:

> For example, let's start with Pythagorean Theorem
>
>    a² + b² = c²
[...]
> [a] [enter]
> [a] [enter]
> [multiply]
> [b] [enter]
> [b] [enter]
> [multiply]
> [add]
> [square root]   # to solve for c

I do

[a] [square]
[b] [square]
[plus]
[square root]

6 keys. (Many operations push the entered value into the x register
without needing the enter key. Also, like with infix calculators,
usually there is a [x^2] key -- in postfix notation on both!)

> [a]
> [square]
> [plus]
> [b]
> [square]
> [square root]

That would give you the value of [b] and leave some rest of the
operation in the (hidden) registers. Actually you need

[a] [square]
[plus]
[b] [square]
[=]
[square root]

7 keys.

Although I started with infix calculators, I find it easier to work
my way out of more complex nested formulas with RPN than to track
the level of parentheses in my mind. Consider something like this:

   3y * x    / (z + 4k)^2    2w + v!   \
   ------  * | ---------- + ---------- |
   5b + z    \   3b * 4x    ln(x + 2y) /

Now this is a PITA either way, but it comes easier for me with RPN.


[Sorry for the late reply -- I subscribed to TUHS earlier this year
and am only now making my way through it.]

-- 
Kein Wunder, wenn bei Leuten, die tagaus, tagein Zugriff auf alles
haben, was die Welt im Internet anbietet, die Fantasie-Sicherungen
durchbrennen.                                    -- Karl Notter


More information about the TUHS mailing list