On this page:
Basic Operators, A Few Examples, A Few Error Examples.
You only need two things to start using Hypatia as a calculator:
First, you need a basic understanding of RPN, namely, that operators are written after their arguments -- see page Reverse Polish Notation (RPN) in chapter "The Basics".
And second, you need to know a few operators -- just eight of them are enough for many purposes.
The operators + - * and / are obvious -- add, subtract, multiply and divide (these are 2-argument operators).
SQ means "square", SQRT means "square root", and RCP means "reciprocal value" (these are 1-argument operators).
And often useful is SUM, an n-argument operator which means, "add up everything that comes before it".
And as an afterthought, let's add the constant PI to the mix.
The question mark followed by a space is Hypatia's input prompt. You do not type it!
? 3 4 +
= 7
(That was easy!)
? 8 5 /
= 1.6
(This, too.)
? 3 5 2 8 1 9 SUM
= 28
(SUM adds up all numbers to its left.)
? 3 5 * 2.5 4 * +
= 25
(The first * multiplies 3 with 5 which makes 15, the second * multiplies 2.5 with 4 which makes 10, and then + adds the two results.)
? 3 5 * 2.5 4 * 3 4 * SUM
= 37
(As above, but now we have three multiplication results -- SUM adds them up.)
? 3 SQ 4 SQ + SQRT
= 5
(The hypotenuse of the right-angled triangle with kathetes 3 and 4 -- the square of 3 is 9, the square of 4 is 16, + returns their sum 25, then SQRT draws the square root.)
? 3.5 SQ PI *
= 38.484510006475
(The area of a circle with the diameter 3.5 -- SQ returns the square of 3.5, PI is the constant pi, and * multiplies the two.)
After each calculation, Hypatia remembers the result -- more about this on the next page.
Note that just entering a single number (or a single variable or constant) is a calculation, too, which can be useful in some circumstances.
We learn from our mistakes -- here are a few possible ones, with the error messages that Hypatia would give:
? 3 4 7 +
Error: argument count mismatch, remaining on stack: 1
(The + operator, adding 4 and 7, returns 11, this should be the result -- but there still remains a superfluous number to its left.)
? 3 5 * 4 * +
Error: argument(s) missing for operator +
(The first * multiplies 3 with 5, the second * multiplies the result with 4 and returns 60 -- but the + operator finds nothing to add 60 to.)
? 3 SQ 4 SQ - SQRT
Error: square root of negative number
(The first SQ returns 9, the second one 16, 9 minus 16 is minus 7 -- Hypatia cannot draw the square root of a negative number.)
Once you've gotten used to RPN I hope that you will come to appreciate its logic and find it easy enough to work with. Still, the reason for an error message may not always be obvious. In that case you can use Hypatia's debugging mode -- see the page after the next, Debugging a Calculation.